Path: utzoo!mnetor!uunet!husc6!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: <9176@tut.cis.ohio-state.edu> Date: 30 Mar 88 04:15:01 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> Organization: The Ohio State University Dept of Computer and Information Science Lines: 28 In article <134@wyse.wyse.com> mikew@wyse.UUCP (Mike Wexler) writes: >I would disagree that is isn't possible to write portable code that requires >volatiles. An example(possibly the only one), is the use of System V >or Berkeley shared memory. ... I might not understand volatile correctly but this might also be an example: volatile int customer_changeable_var = 0; main( ) ... if (customer_chageable_var != 0) { ... } If the volatile were dropped off, the compiler would be free to optimize out the "impossible" code. A customer changeable global variable is a handy way for implementing optional features that customers may or may not want; especially in programs that should avoid disk i/o. -- Larry Cipriani, AT&T Networks Systems (day) Ohio State University (night) Domain: lvc@tut.cis.ohio-state.edu Path: ...!cbosgd!osu-cis!tut.cis.ohio-state.edu!lvc (weird but right)