volatile: a summary

Karl Heuer karl at haddock.ISC.COM
Sat Jun 11 02:59:50 AEST 1988


In article <796 at l.cc.purdue.edu> cik at l.cc.purdue.edu (Herman Rubin) writes:
>[In the code fragment "x = random();"] it is essential that the computation
>of random() be done at _each_ call.  Volatile beats all of the kludges I
>have seen to accomplish this.

I don't see what this has to do with the |volatile| in dpANS.  C makes no
provisions for pure functions, so random() (or getchar()) must always be
invoked no matter what (subject, as always, to the as-if rule).

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list