A different view of volatile

David Collier-Brown daveb at geac.UUCP
Mon May 16 22:44:27 AEST 1988


> >In article <178 at wyse.wyse.com> mikew at wyse.wyse.com appears to write:
> >More than that, volatile is ill-defined *always*: on a machine
> >with only halfword load and stores, a fullword `a = 0' is not atomic.

In article <1054 at micomvax.UUCP> ray at micomvax.UUCP (Ray Dunn) writes:
>No....volatile is not ill defined, it is machine dependant, which is what
>you would expect it to be.
>There is no connection between "volatile" and "atomic", "volatile" does not
>imply "semaphore".

In the case of a fullword device register on a halfword-fetch
machine, the **machine** is ill-defined.  Volatile hardly helps.  It
does help on a halfword device register by ensuring that two reads
are done for
	status = device_register_foo;
It remains up to the device designer to make it possible to read the
register meaningfully in halves.

--dave (please let me NOT work on one of those) c-b



More information about the Comp.lang.c mailing list