Interpretation of volatile - two questions
Henry Spencer
henry at utzoo.uucp
Tue Mar 20 02:59:31 AEST 1990
In article <2604A628.8521 at paris.ics.uci.edu> rfg at 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 at zoo.toronto.edu
More information about the Comp.std.c
mailing list