Volatile type in ANSI C

Henry Spencer henry at utzoo.UUCP
Sun Apr 28 10:29:53 AEST 1985


> Looking at the description for the volatile type in the draft of the
> ANSI C standard there seems to be some incompleteness.
> The volatile type could have uses in multiprocessing where several
> processors share some data areas.  One could have volatile pointers to
> non volatile data areas (rarely) and more frequently nonvolatile pointers
> to volatile data areas that are shared with other processors.
> Does the ANSI C standard address these issues?

Yes.  It provides both.  "volatile int *foo;" declares a nonvolatile
pointer to volatile; "int * volatile foo;" declares a volatile pointer
to nonvolatile.  (Excuse me a moment while I barf over the syntax.)
If you're really a masochist, "volatile int * volatile foo;" is a
volatile pointer to a volatile area.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list