This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: volatile [was: GCC warnings for unused global variables]
On May 4, 2003, Fergus Henderson <fjh@cs.mu.OZ.AU> wrote:
>> They can be
>> created with the initialized value, if that can be calculated at
>> compile time (e.g., if there is no constructor).
> That is true for non-volatile variables, but only because the compiler
> can apply the as-if rule. As discussed earlier in this thread, the
> as-if rule does not apply to volatile variables -- the standard prohibits
> implementations from optimizing away accesses to volatile variables.
Except that the object only becomes volatile after it is initialized.
Otherwise, there'd be no constructor to initialize it, since
cv-qualifiers don't make it to the type of `this' in cdtors.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer