volatile
Lawrence V. Cipriani
lvc at tut.cis.ohio-state.edu
Fri Apr 1 08:08:09 AEST 1988
In article <18686 at think.UUCP> barmar at fafnir.think.com.UUCP (Barry Margolin) writes:
>In article <9176 at tut.cis.ohio-state.edu> lvc at tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes:
>> ... my small example of using volatile ...
>>
>>If the volatile were dropped off, the compiler would be free to
>>optimize out the "impossible" code. ...
> ... Notes on use of static ...
>Barry Margolin
You are right. Try this instead:
volatile static customer_changeable_var = 0;
main()
...blah blah blah...
if (customer_changeable_var != 0)
{
...code for optional feature...
}
This would be in a compiled program a customer could edit with adb
or sdb. If the compiler were free to optimize out the "impossible"
code this would no longer work. Thanks for the note.
--
Larry Cipriani, AT&T Network Systems and Ohio State University
Domain: lvc at tut.cis.ohio-state.edu
Path: ...!cbosgd!osu-cis!tut.cis.ohio-state.edu!lvc (weird but right)
More information about the Comp.lang.c
mailing list