Path: utzoo!attcan!utgpu!watmath!watdragon!violet!afscian From: afscian@violet.waterloo.edu (Anthony Scian) Newsgroups: comp.std.c Subject: Re: volatile required? Message-ID: <16785@watdragon.waterloo.edu> Date: 29 Sep 89 14:30:35 GMT References: <712@Aragorn.dde.dk> Sender: daemon@watdragon.waterloo.edu Reply-To: afscian@violet.waterloo.edu (Anthony Scian) Organization: U. of Waterloo, Ontario Lines: 21 In article <712@Aragorn.dde.dk> ct@dde.dk (Claus Tondering) writes: >Consider the following program: > > main() > { > int p=3, *q=&p; > > *q=4; > printf("%d\n",p); > } > >Is it acceptable that this program prints 3 instead of 4? NO. This is a convenient type of oversight that allows so called "optimizing compilers" like Turbo C and Microsoft C to squeeze out extra performance from benchmarks. Too bad if production code doesn't run with the optimizer turned on. True optimizing compilers (WATCOM C,GNU CC) don't resort to "tricks" like this. -- Anthony //// Anthony Scian afscian@violet.uwaterloo.ca afscian@violet.waterloo.edu //// "I can't believe the news today, I can't close my eyes and make it go away" -U2