volatile required?

Anthony Scian afscian at violet.waterloo.edu
Sat Sep 30 00:30:35 AEST 1989


In article <712 at Aragorn.dde.dk> ct at 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 at violet.uwaterloo.ca afscian at violet.waterloo.edu ////
"I can't believe the news today, I can't close my eyes and make it go away" -U2



More information about the Comp.std.c mailing list