Article View: comp.std.c
Article #580Re: No sequence points in assignment
From: Tom Karzes
Date: Wed, 13 Sep 1989 17:20
Date: Wed, 13 Sep 1989 17:20
26 lines
1669 bytes
1669 bytes
In article <1989Sep13.005247.20121@algor2.algorists.com> jeffrey@algor2.UUCP (Jeffrey Kegler) writes:
-In article <1021@m3.mfci.UUCP> karzes@mfci.UUCP (Tom Karzes) writes:
->Consider the following statement:
->
-> x = a + (x = b);
->
->Could the assignment for (x = b) be performed after the outer
->assignment?
-
-In ANSI C (3.3), this is undefined behavior, meaning anything (core
-dump, generation of random number, etc.) can happen. In all
-likelihood, and in Classic C, you get the assignments performed in
-whatever order amuses the compiler.
Yes, this is what I was looking for. I simply didn't look in the right
place (I looked under the description of assignment operators). The
second paragraph in section 3.3 says:
Between the previous and next sequence point an object shall have
its stored value modified at most once by the evaluation of an
expression. Furthermore, the prior value shall be accessed only
to determine the value to be stored.
Presumably a good compiler would give a warning in the obvious case
where there are multiple assignments to a scalar with no intervening
sequence points.
Technical Details
Message-ID:
<1026@m3.mfci.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!usc!ginosko!uunet!yale!mfci!karzesReferences:
<1021@m3.mfci.UUCP> <1989Sep13.005247.20121@algor2.algorists.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!usc!ginosko!uunet!yale!mfci!karzes From: karzes@mfci.UUCP (Tom Karzes) Newsgroups: comp.std.c Subject: Re: No sequence points in assignment Message-ID: <1026@m3.mfci.UUCP> Date: 13 Sep 89 17:20:40 GMT References: <1021@m3.mfci.UUCP> <1989Sep13.005247.20121@algor2.algorists.com> Sender: karzes@mfci.UUCP Reply-To: karzes@mfci.UUCP (Tom Karzes) Distribution: comp Organization: Multiflow Computer Inc., Branford Ct. 06405 Lines: 26