C optimizer

Rob Carriere rob at kaa.eng.ohio-state.edu
Thu Feb 16 03:26:58 AEST 1989


In article <36034 at bbn.COM> mesard at 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).  Hint: Sleep(3) would,
>I believe, be labelled "pure" under this definition, so something's
>still missing.

What seems to be missing is the idea that sleep *does* modify
something, namely time.  So formally speaking, your compiler should
consider sleep to have a side effect on a variable called __time.  If
you do that, there's no problem.

SR



More information about the Comp.lang.c mailing list