Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!lvc From: lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) Newsgroups: comp.lang.c Subject: Re: volatile Message-ID: <9337@tut.cis.ohio-state.edu> Date: 31 Mar 88 22:08:09 GMT References: <12578@brl-adm.ARPA> <1988Mar25.172355.348@utzoo.uucp> <588@imagine.PAWL.RPI.EDU> <1988Mar29.004454.2867@utzoo.uucp> <134@wyse.wyse.com> <9176@tut.cis.ohio-state.edu> <18686@think.UUCP> Organization: The Ohio State University Dept of CIS Lines: 29 In article <18686@think.UUCP> barmar@fafnir.think.com.UUCP (Barry Margolin) writes: >In article <9176@tut.cis.ohio-state.edu> lvc@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@tut.cis.ohio-state.edu Path: ...!cbosgd!osu-cis!tut.cis.ohio-state.edu!lvc (weird but right)