From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,751584f55705ddb7 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Side-effect arithmetic again [was: Ada ... in embedded systems] Date: 1996/03/25 Message-ID: #1/1 X-Deja-AN: 144172006 references: organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-03-25T00:00:00+00:00 List-Id: In article , Tucker Taft wrote: >As a small anecdote here relating to the "op=" operations of C, >my most recent "favorite" bug in C code I was writing was in the following: > > if (a /= b) { > ... > } Ouch. But I don't blame this on the existence of the shorthand notation. I blame it on (1) the fact that the assignment operators like /= return a value, and (2) the fact that there is no separation between boolean and integer types. If (1) were fixed, the problem would go away, and if (2) were fixed, the problem would be extremely rare. >At this point Dave Emery comes on and asks me why in the world >I am writing any code in C... ;-} Indeed. ;-) - Bob