C optimizer

Peter da Silva peter at ficc.uu.net
Fri Feb 17 08:16:00 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).

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 at ficc.uu.net, +1 713 274 5180.   `-_-'
Home: bigtex!texbell!sugar!peter, peter at sugar.uu.net.                 'U`
People have opinions. Companies have policy. And typos are my own business.



More information about the Comp.lang.c mailing list