C optimizer

John Woods john at frog.UUCP
Fri Mar 3 06:46:00 AEST 1989


In article <453 at lakart.UUCP>, dg at lakart.UUCP (David Goodenough) writes:
O> From article <36662 at think.UUCP>, by barmar at think.COM (Barry Margolin):
O> ] In article <1028 at frog.UUCP> john at frog.UUCP (John Woods) writes:
P> ]>I think that if
S> ]>	(getpid() != getpid())
 > ]>ever evaluated to 1, I would be severely astonished.
O> ] Well, how about
O> ] 	(pid = getpid(), (void) fork(), pid != getpid())
P> True - but I don't see any references to fork() in Mr.Woods' posting.
S> What he is stating is that _IN THE ABSENCE_ of fork() calls, getpid()
 > had better return an unchanging value.

No, what I was stating was that getpid() was a pure function.  Pure functions
are supposed to be pure functions even in the presense of other function calls.
It is that property which allows them to be aggressively optimized.  It is
obvious that I was mistaken.  As I have said to the first two people to
point this out,


			oops.




-- 
John Woods, Charles River Data Systems, Framingham MA, (508) 626-1101
...!decvax!frog!john, john at frog.UUCP, ...!mit-eddie!jfw, jfw at eddie.mit.edu

"He should be put in stocks in Lafeyette Square across from the White House
 and pelted with dead cats."	- George F. Will



More information about the Comp.lang.c mailing list