volatile required?

Wm E Davidsen Jr davidsen at crdos1.crd.ge.COM
Wed Oct 4 00:42:19 AEST 1989


In article <16785 at watdragon.waterloo.edu>, afscian at violet.waterloo.edu (Anthony Scian) writes:
|  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.

  I wrote a reply saying that MSC v4.85 and later didn't do this.
Someone replied that if certainly did, if you use the -Oa option.

  For the record, that's true. If you use -Oa to tell the compiler to
ignore aliasing it will. If you use -Ox (perform unsafe optimizations)
it will do funny things in complex code. And if you use -M2 (generate
286 code) it won't run on your XT. 

Having the compiler do just what you requested doesn't seem like an
error to me. X3J11 recognized the need to tell compilers in general
what is safe when they added volatile (and the brief moments when
noalias existed). When a user selects a option which tells the compiler
to ignore possible problems s/he certainly shouldn't be surprized if
the problems come up. If this happened with the standard -O option I
would agree that a bug was present.

-- 
bill davidsen	(davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon



More information about the Comp.std.c mailing list