A volatile question

David Keppel pardo at cs.washington.edu
Mon Mar 19 11:56:54 AEST 1990


I have a question about the meaning of ``volatile''.  Suppose:

	foo (volatile int *zork) { ... }

	bar()
	{
	    int zork;
	    foo (&zork);
	    ...
	}

The behavior that I want is that `zork' can be cached (e.g., in a
register) in `bar', but that it must be treated as `volatile' in
`foo'.  If the optimizer is allowed to to optimize away the
`volatileness' of zork inside `foo'?  If it is, what is the correct
way to code this function?

	;-D on  ( A constant question about volatile )  Pardo
-- 
		    pardo at cs.washington.edu
    {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo



More information about the Comp.std.c mailing list