volatile, noalias and optimization
Charles Marslett
chasm at killer.UUCP
Wed Apr 27 15:32:29 AEST 1988
In article <132 at atpal.UUCP>, tneff at atpal.UUCP (Tom Neff) writes:
> It's been pointed out at some length that the new /volatile/ and /noalias/
> keywords are really all about controlling the optimizer in various C
> implementations, more than about the language itself. Thus /volatile/
> says "treat this variable no different syntactically, in type, usage etc.,
> but DON'T optimize access to its memory location when you generate code;
> go 'to the metal' every blessed time." This is a wonderful feature to
> have, a real "plus" for systems work... but shouldn't we use
>
> #pragma volatile(var1, var2, var3)
>
> instead of imposing a new keyword on the language grammar? And ditto for
I'll go along with this if we will (for consistency sake) also banish
"register", "short" and "void" with it. They all have similar impure
usage. "Register" is even an optimizer directive, if I ever saw one. And
"void" is documentation/lintification feature that probably doesn't serve
its purpose near as well as "volatile" does its own. Sure the language
becomes a bit more verbose, somewhat more difficult to read (somewhat
more like Pascal (?)), but the inferences are useful when you need them,
and I don't like "#pragma" as a compiler directive any more than I did
"#line" -- kludges, only if you gotta use 'em!
Did I step on any toes this time?
> Tom Neff UUCP: ...uunet!pwcmrd!skipnyc!atpal!tneff
Charles Marslett
chasm at killer.UUCP
More information about the Comp.lang.c
mailing list