🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9498

Re: expression sequencing bugs

#9498
From: Gunnar Stefansson
Date: Fri, 03 Oct 1986 07:08
20 lines
1473 bytes
In article <4197@brl-smoke.ARPA> C90630JG%WUVMD.BITNET@wiscvm.ARPA writes:
>In article <760@oakhill.UUCP> tomc@oakhill.UUCP (Tom Cunningham) writes:
>>    /* a = b + b + b */
>>    a = ((b=1),b) + ((b=2),b) + ((b=3),b)
>>
>>I expected the result to be 6.  With the Microsoft C compiler and the
>>compiler on the Sun 3, the result is 9.  Apparently the parenthetical
>>assignments are all getting done before the comma and addition.  Any
>>thoughts on this?
>>
>Tom, I agree, the result should be 6, as defined by K&R, but I have tried
>it on ......................
>I would like everyone to test it on as many machines as prossible, to
>see if we can find as least ONE other besides Small-C, that works.

Just for the record, our HP 9000, Model 550 running HP-UX returns
the value 6. Surely anything else isn't just strange, bizarre,..., but
just plain a compiler bug.

Gunnar
Technical Details
Message-ID: <279@hafro.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!enea!hafro!gunnar
References: <4197@brl-smoke.ARPA> <760@oakhill.UUCP>

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!mcvax!enea!hafro!gunnar
From: gunnar@hafro.UUCP (Gunnar Stefansson)
Newsgroups: net.lang.c
Subject: Re: expression sequencing bugs
Message-ID: <279@hafro.UUCP>
Date: Fri, 3-Oct-86 03:08:30 EDT
Article-I.D.: hafro.279
Posted: Fri Oct  3 03:08:30 1986
Date-Received: Tue, 7-Oct-86 23:19:50 EDT
References: <4197@brl-smoke.ARPA> <760@oakhill.UUCP>
Reply-To: gunnar@hafro.UUCP (Gunnar Stefansson)
Organization: Marine Research Institute, Reykjavik.
Lines: 20
Summary: HP-UX gives 6.