volatiles

Henry Spencer henry at utzoo.uucp
Sun Apr 17 08:04:26 AEST 1988


> ... volatile is just a HACK to make the
> optimization technique work!   volatile adds no additional expressive
> power to the language, neither is it adding convenience - it only
> tell the optimizer where it is about to goof up so the optimizer
> doesn't commit a blunder!

This whole debate is entirely a matter of definitions.  If you believe,
deep down in your heart, that C is basically a sequential language and the
compiler is entitled to assume that, then such optimizations are entirely
legitimate.  If you believe, deep down in your heart, that C ought to be
parallel-capable with no effort on your part, then of course such
optimizations are abominations that should not have to be explicitly
disabled.  There is no point in screaming at each other in attempts to
change the other's mind; you are arguing from different underlying
assumptions, and no amount of rational (or irrational) debate will change
anyone's mind unless the assumptions change.

Historically, by the way, C has been a sequential language and parallel
folks have had to watch their step and make allowances.  I see no reason
to change this.  In fact I see reasons not to change it, since parallelism
requires care anyway -- not every multiprocessor machine has hardware-
guaranteed cache consistency, for example -- and most existing C code
requires no parallelism and would prefer to run fast.
-- 
"Noalias must go.  This is           |  Henry Spencer @ U of Toronto Zoology
non-negotiable."  --DMR              | {ihnp4,decvax,uunet!mnetor}!utzoo!henry



More information about the Comp.lang.c mailing list