volatile

Chris Torek chris at mimsy.UUCP
Tue May 17 20:52:26 AEST 1988


In article <526 at wsccs.UUCP> terry at wsccs.UUCP (Every system needs one) writes:
>Why can't the compiler figure out what is volitile and
>THEN optimize without being hit over the head?

In many cases it can.  This is one of several reasonably good arguments
against volatile.  One pro-volatile (or #pragma) counterargument is that
it helps the reader to realise that there is something unusual going on
here too---not that this cannot be done with a comment.

>>Compiler technology is getting really good, and we need a way to tell
>>the optimisers that strange things can happen.

>If it's sooooo advanced, it could determine volatility (or aliasing)
>without me having to tell it.

Could and should: I agree.  But (as dmr put it) the nice thing about
`volatile' is that the average programmer can ignore it; this was
not true of `noalias'.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list