Path: utzoo!attcan!uunet!mailrus!ames!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: Interpretation of volatile - two questions Message-ID: <12400@smoke.BRL.MIL> Date: 22 Mar 90 17:51:05 GMT References: <2604A628.8521@paris.ics.uci.edu> <1990Mar19.165931.22758@utzoo.uucp> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 16 In article daveg@near.cs.caltech.edu (Dave Gillespie) writes: >... a compiler on such a machine could surround a >volatile object with enough padding to keep it isolated. There are two problems with this. The minor one is that it wasn't the intention of X3J11 (as I understand it) for type qualifiers to affect representations, which is what an impact on padding would amount to. The more important one is that examples like the one we were using are typical of access to device registers, for which spurious padding would simply mean inability to access some of the register contents. I've encountered examples of Unibus devices and PDP-11 CPU memory access combinations where one had to be extraordinarily careful, due to such things as a WRITE cycle having a different effect from a READ-MODIFY-WRITE. There is a limit to how much of this sort of thing can reasonably be reflected in C language rules, which is one of the reasons that the meaning of volatile access is implementation defined.