Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!brutus.cs.uiuc.edu!jarthur!spectre.ccsf.caltech.edu!spectre.ccsf.caltech.edu!daveg From: daveg@near.cs.caltech.edu (Dave Gillespie) Newsgroups: comp.std.c Subject: Re: Interpretation of volatile - two questions Message-ID: Date: 22 Mar 90 04:30:32 GMT References: <2604A628.8521@paris.ics.uci.edu> <1990Mar19.165931.22758@utzoo.uucp> Sender: news@spectre.ccsf.caltech.edu Organization: California Institute of Technology Lines: 26 In-Reply-To: henry@utzoo.uucp's message of 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? Henry Spencer and Doug Gwyn point out that on a word-addressed machine it may not be possible to read c1 without touching c2 as well. But it seems to me that compilers have the flexibility to pad out structures in order to avoid this---a compiler on such a machine could surround a volatile object with enough padding to keep it isolated. Even if the standard does not specify (c), it seems to me that it reasonably *could*. -- Dave -- Dave Gillespie 256-80 Caltech Pasadena CA USA 91125 daveg@csvax.caltech.edu, ...!cit-vax!daveg