🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #6281

Re: assignment to/from volatile execution sequence

#6281
From: Karl Heuer
Date: Tue, 06 Mar 1990 00:42
20 lines
1402 bytes
Taking the easy question first...

In article <36669@mips.mips.COM> lai@mips.COM (David Lai) writes:
>	a = *(b++) = c; /* will b be incremented twice? */

No.  Even if the abstract machine semantics require you to fetch back the
value from memory, the location of the object denoted by *b++ has already been
determined and should not be re-evaluated.  This is the same reason that
	*p++ += 1;
increments p only once.

>[What happens if the middle lvalue is volatile?]

Good question.  Is it intended to be the value that was stored there, or the
value that is read back?  These are equivalent for nonvolatiles, and the
Committee may have overlooked this situation.  I suggest you write the X3
Secretariat for an official interpretation.

Karl W. Z. Heuer (karl@ima.ima.isc.com or harvard!ima!karl), The Walking Lint
(I also strongly disrecommend writing any code that depends on such nuances!)
Technical Details
Message-ID: <16096@haddock.ima.isc.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!xylogics!merk!spdcc!ima!haddock!karl
References: <36669@mips.mips.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!xylogics!merk!spdcc!ima!haddock!karl
From: karl@haddock.ima.isc.com (Karl Heuer)
Newsgroups: comp.std.c
Subject: Re: assignment to/from volatile execution sequence
Keywords: abstract machine
Message-ID: <16096@haddock.ima.isc.com>
Date: 6 Mar 90 00:42:06 GMT
References: <36669@mips.mips.COM>
Reply-To: karl@haddock.ima.isc.com (Karl Heuer)
Organization: Interactive Systems, Cambridge, MA 02138-5302
Lines: 20