🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9513

Sequence of Evaluation: a = ((b=1),b) + ((b=2),b) + ((b=3),b);

#9513
From: Joshua W. Knight
Date: Tue, 07 Oct 1986 20:20
26 lines
1854 bytes
This has been thoroughly discussed, so let me just point out the part
of the minutes of the June 1986 meeting of the ANSI C standards group
that makes me believe that the current standard MAY require the value
6 (I wasn't clear earlier).  In addition to providing that comma
operators are sequence points, it appears to me to be required that
the evaluation of an expression whose top operator is an operator
with a sequence point not be interleaved with other evaluations.
I wasn't at the meeting (haven't been to any) and I haven't seen the
latest version of the draft standard.

I point out (just to be contentious ;-) that while a Harbison was at
the June 1986 meeting of the ANSI C standards group, there was neither
a Kernighan nor a Ritchie there.

Also, as if the whole mess wasn't ambiguous enough already, I encourage
those who find that a compiler/optimization level gets a=6, (and a lower
optimization level does not), to change the 2 to a 3 and the 3 to a 7 to
make sure that it doesn't then get 9 instead of 11.  I.e. to make sure
that it is not just moving around the 3 assignment operations still
*before* the rest of the expression.  After all 6 = 1+2+3 = 2+2+2 ;-)

Of course, I speak only for myself, not for my employer.

			Josh Knight
			IBM T.J. Watson Research Center
josh@ibm.com, josh@yktvmh.BITNET
Technical Details
Message-ID: <4419@brl-smoke.ARPA>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!columbia!rutgers!caip!brl-adm!brl-smoke!smoke!JOSH@ibm-sj.ARPA

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!columbia!rutgers!caip!brl-adm!brl-smoke!smoke!JOSH@ibm-sj.ARPA
From: JOSH@ibm-sj.ARPA (Joshua W. Knight)
Newsgroups: net.lang.c
Subject: Sequence of Evaluation:  a = ((b=1),b) + ((b=2),b) + ((b=3),b);
Message-ID: <4419@brl-smoke.ARPA>
Date: Tue, 7-Oct-86 16:20:18 EDT
Article-I.D.: brl-smok.4419
Posted: Tue Oct  7 16:20:18 1986
Date-Received: Wed, 8-Oct-86 07:29:50 EDT
Sender: news@brl-smoke.ARPA
Lines: 26