volatile

Walter Bays walter at garth.UUCP
Sun Apr 10 10:44:20 AEST 1988


In article <4346 at ihlpf.ATT.COM> nevin1 at ihlpf.UUCP (00704a-Liber,N.J.) writes:
>No, what this means is that in the future, when we have highly optimizing
>compilers and highly efficient hardware (such as caches,etc.), that this code
>may break.  In order to do certain types of optimizations, certain assumptions
>have to be made.  For example, if I know that a certain variable has no
>aliases, then in the implementation I can keep it's value in a cache (which
>is faster) without having to update the actual memory location it is
>suppose to be stored at.  As things stand now, these assumptions are made
>on a compiler-by-compiler basis.

I agree.  Worse, in many cases the future is now.  Usually the
compiler must forgo optimizations that would work for nearly all
programs for fear of breaking a few.  And remember, optimization is
more important for RISC than for CISC.  C wizards will use 'volatile'
and 'noalias'.  Ordinary users may totally ignore them, and will still
get the benefit of faster applications running on faster kernels.
-- 
------------------------------------------------------------------------------
Any similarities between my opinions and those of the
person who signs my paychecks is purely coincidental.
E-Mail route: ...!pyramid!garth!walter
USPS: Intergraph APD, 2400 Geng Road, Palo Alto, California 94303
Phone: (415) 852-2384
------------------------------------------------------------------------------



More information about the Comp.lang.c mailing list