Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cwjcc!tut.cis.ohio-state.edu!bloom-beacon!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: comp.lang.c Subject: Re: C optimizer Message-ID: <1470@mcgill-vision.UUCP> Date: 15 Mar 89 10:16:51 GMT References: <36662@think.UUCP> <453@lakart.UUCP> Organization: McGill University, Montreal Lines: 21 In article <453@lakart.UUCP>, dg@lakart.UUCP (David Goodenough) writes: > From article <36662@think.UUCP>, by barmar@think.COM (Barry Margolin): >> In article <1028@frog.UUCP> john@frog.UUCP (John Woods) writes: >>> (getpid() != getpid()) [should always be 1] >> Well, how about >> (pid = getpid(), (void) fork(), pid != getpid()) > True - but I don't see any references to fork() in Mr.Woods' posting. > What he is stating is that _IN THE ABSENCE_ of fork() calls, getpid() > had better return an unchanging value. Sure - and in the absence of assignments, variables are constant and can be optimized away. The whole point of this was to find a pure syscall, and a routine isn't pure if calling another routine can cause it to change its return value for a given set of argument values. Thus, fork()'s changing the return value of getpid() means that getpid() can't be considered pure. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu