volatile: a summary

Chris Torek chris at mimsy.UUCP
Mon Jun 13 20:53:29 AEST 1988


In article <5080025 at hpfcdc.HP.COM> cunniff at hpfcdc.HP.COM (Ross Cunniff) writes:
[stuff about shared memory]
>Oh, sure, you could have a dictionary that says that 'volatile shm_get',

(Well, at least you thought about it.)  Yes, you would have to do exactly
that, or else not optimise anything that comes back from a system call.

>but if you're going to go that far, you might as well just add volatile
>to the standard (oh, we're already doing that?).

The point is that it is not *necessary* to add volatile as a keyword in
the language.  I will not go as far as Robert Firth and call it
`stupid'; indeed, I happen to like the keyword, even though it is a
`hacker's solution'.  It is fast and easy, whereas a detailed analysis
of possible aliasing and volatility is hard and likely to be slow.
Having the keyword is much like having assembly language handy:  when
you want to do something unusual, it is easy.  Error-prone and kludgey,
perhaps, but definitely easy.

It is just not *necessary*.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list