This is the mail archive of the
mailing list for the GCC project.
RE: Optimization of conditional access to globals: thread-unsafe?
On Sat, 27 Oct 2007, skaller wrote:
> The point is -- there is no new rule here, and no definition
> of what a volatile semantics is: volatile variables have
> the SAME 'semantics' as any other variable. If I write:
> int a = 1;
> printf("%d", a);
> int b = 2;
> then it is just the same as if a,b were volatile.
Not at all. As neither a nor b are global memory, printf() (or any other
function) could not access them, hence no observer could determine if or
if not 'b' is already set. In contrast to when a and b were volatile.