🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1934

Re: A question on volatile accesses

#1934
From: Doug Gwyn
Date: Sun, 04 Nov 1990 05:07
18 lines
1017 bytes
In article <2388@lupine.NCD.COM> rfg@lupine.ncd.com (Ron Guilmette) writes:
>	volatile int *ip;
>			i = *++ip;
>In other words, could the program above legally be treated as:
>	volatile int *ip;
>			i = *ip;
>			++ip;

"volatile" has nothing to do with this.

The above rewrite would be incorrect in any case.  Better would be
	volatile int *ip;
			i = ip[1];
			++ip;

The only places in the code where side effects are required to be
brought up to date (synchronized) are at sequence points, such as
at the end of the assignment statement in the original code.
Technical Details
Message-ID: <14327@smoke.brl.mil>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn
References: <2388@lupine.NCD.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn
From: gwyn@smoke.brl.mil (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: A question on volatile accesses
Message-ID: <14327@smoke.brl.mil>
Date: 4 Nov 90 05:07:01 GMT
References: <2388@lupine.NCD.COM>
Organization: U.S. Army Ballistic Research Laboratory, APG, MD.
Lines: 18