Newsgroups: comp.std.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: Interpretation of volatile - two questions
Message-ID: <1990Mar19.165931.22758@utzoo.uucp>
Organization: U of Toronto Zoology
References: <2604A628.8521@paris.ics.uci.edu>
Date: Mon, 19 Mar 90 16:59:31 GMT

In article <2604A628.8521@paris.ics.uci.edu> rfg@paris.ics.uci.edu (Ronald Guilmette) writes:
>	struct s {
>		char		c1;
>		volatile char	c2;
>	};
>...
>		c = memory_mapped_device_p->c1;
>...
>does the standard (a) permit, (b) require, or (c) prohibit the assignment
>statement shown to access the c2 field of the "struct s" pointed to by
>memory_mapped_device_p?

The standard, by and large, is silent about the *details* of how volatile
works.  Necessarily so; it's very machine-specific.  Suppose your machine's
bus only does word accesses, and it *cannot* access c1 without also
touching c2?  In general, you have to know the machine and the compiler
to know the exact semantics in such situations; the method of specifying
volatility is machine-independent, but the results are not.
-- 
MSDOS, abbrev:  Maybe SomeDay |     Henry Spencer at U of Toronto Zoology
an Operating System.          | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
