Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!itsgw!steinmetz!uunet!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: C optimizer Keywords: C pure function optimization Message-ID: <3121@ficc.uu.net> Date: 16 Feb 89 22:16:00 GMT References: <515@larry.UUCP> <9648@smoke.BRL.MIL> <36034@bbn.COM> Organization: Xenix Support Lines: 26 In article <36034@bbn.COM>, mesard@bbn.com (Wayne Mesard) writes: > A function which is entirely composed of known "pure" operations* > is, itself, pure. > * Where pure operations is defined as functions that produce no side > effects and return deterministic values, and most operators (excluding > assignment to dereferenced pointers and globals). Sounds good. > Hint: Sleep(3) would, > I believe, be labelled "pure" under this definition, so something's > still missing. No, since I don't think *any* system call is definable as a pure function. In this case alarm() returns a nondeterministic value *and* produces the side effect of setting a timer in your process table entry. Can anyone think of any pure system calls? ioctl(fd, TCGETA, tbuf)? No, I think a system call should be considered not only a global ref but a volatile one! -- Peter da Silva, Xenix Support, Ferranti International Controls Corporation. Work: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180. `-_-' Home: bigtex!texbell!sugar!peter, peter@sugar.uu.net. 'U` People have opinions. Companies have policy. And typos are my own business.