volatile: is NOT a frill, i
aglew at urbsdc.Urbana.Gould.COM
aglew at urbsdc.Urbana.Gould.COM
Fri Apr 15 01:33:00 AEST 1988
>> extern volatile int user_interrupt;
>> while (!user_interrupt)
>> sleep(1);
>>
>> Carrick Talmadge clt at newton.physics.purdue.edu
>
>Please do not misunderstand me, I would like to see "volatile"
>added -- but why would it be required above? If "user_interrupt"
>is an external variable, then the compiler is not free to assume
>that it will not change across a function call. Since you call
>sleep() in the loop, the compiler is not free to use the cached value
>of user_interrupt from the previous iteration.
>
>Greg LImes [limes at sun.com]
I have some hope of seeing decent cross-procedural and global analysis
in production C compilers in my lifetime ;-}. In which case, the
compiler may be able to prove that user_interrupt is not modified
by any function called...
So, what do you want: "synchronous volatile" and "asynchronous
volatile"?
aglew at gould.com
More information about the Comp.lang.c
mailing list