🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9416

expression sequencing bugs

#9416
From: C90630JG%WUVMD.BITNET
Date: Sat, 27 Sep 1986 05:53
21 lines
1354 bytes
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.

Mike Stump  ucbvax!hplabs!csun!csunb!beusemrs

I would like to report that the Computer Innovations C86 C complier
on the IBM-PC produces the correct answer.

Jonathen Goldberg
c90630jg@wuvmd.bitnet
Technical Details
Message-ID: <4197@brl-smoke.ARPA>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!ihnp4!qantel!lll-lcc!lll-crg!seismo!columbia!caip!brl-adm!brl-smoke!smoke!C90630JG%WUVMD.BITNET@wiscvm.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!watmath!clyde!cbatt!ihnp4!qantel!lll-lcc!lll-crg!seismo!columbia!caip!brl-adm!brl-smoke!smoke!C90630JG%WUVMD.BITNET@wiscvm.ARPA
From: C90630JG%WUVMD.BITNET@wiscvm.ARPA
Newsgroups: net.lang.c
Subject: expression sequencing bugs
Message-ID: <4197@brl-smoke.ARPA>
Date: Sat, 27-Sep-86 01:53:24 EDT
Article-I.D.: brl-smok.4197
Posted: Sat Sep 27 01:53:24 1986
Date-Received: Tue, 30-Sep-86 08:26:36 EDT
Sender: news@brl-smoke.ARPA
Lines: 21