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: stt@henning.camb.inmet.com (Tucker Taft) Subject: Re: Side-effect arithmetic again [was: Ada ... in embedded systems] Date: 1996/03/25 Message-ID: #1/1 X-Deja-AN: 144105242 sender: news@inmet.camb.inmet.com (USENET news) x-nntp-posting-host: henning.camb.inmet.com references: organization: Intermetrics, Inc. newsgroups: comp.lang.ada Date: 1996-03-25T00:00:00+00:00 List-Id: Robert Dewar (dewar@cs.nyu.edu) wrote: : I also think that the extnsion of these operators, dubious in the first : place, to weird cases like mod is a disservice. I can put up with += in : C but I find the use of things like %= and ^= to be tortured syntax, : which I prefer NOT to import in any case. 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) { ... } The GCC compiler nicely warns you if you write "if (a = b) {" and suggests an extra level of parentheses to emphasize that you really want an assignment, not an equality, operator. Unfortunately, it isn't so helpful with the "op=" operators, and presumes that if you use one of those, you know what you are doing. Alas, after writing a lot of Ada, I didn't in this case. Of course what I meant was "if (a != b) {". Instead, I divided A by B, and tested the result for non-zero-ness. Groink! At this point Dave Emery comes on and asks me why in the world I am writing any code in C... ;-} -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Cambridge, MA USA