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,d1df6bc3799debed X-Google-Attributes: gid103376,public From: kaz@vision.crest.nt.com (Kaz Kylheku) Subject: Re: Not intended for use in medical, Date: 1997/05/06 Message-ID: <5kmek2$9re@bcrkh13.bnr.ca>#1/1 X-Deja-AN: 239667514 References: <3.0.32.19970423164855.00746db8@mail.4dcomm.com> <5kgu95$kb7@bcrkh13.bnr.ca> <5kl9qc$g4d@bcrkh13.bnr.ca> Organization: Prism Systems Inc. Newsgroups: comp.lang.ada Date: 1997-05-06T00:00:00+00:00 List-Id: In article <5kl9qc$g4d@bcrkh13.bnr.ca>, Kaz Kylheku wrote: >In article , Robert Dewar wrote: >>Kaz said >> >><> example to spark a discussion about C semantics, but just to clear up, >> the && operator in C has sequencing properties. Its left constituent >> must not only be evaluated before its right, but its side effects must >> also be settled before the left side is evaluated. Hence x++ && x++ is >> perfectly well defined. The program I was writing depended on this crucial >> sequencing property.>> >> >> Yes, legal, but horrible. A good reminder of why Ada does NOT have >> the ++ operator built in :-) By the way, the x++ is just another way of writing the assignment expression x += 1, or x = x + 1 (the latter case evaluates x twice, of course). The real ``evil'' perhaps is that in C an assignment is an expression rather than a statement, so that you can decorate a complex expression with assignments all over the place. Note that this is one of the areas of C which C++ _worsens_ significantly. In C++, the result of an assignment expression is not only an expression itself, but it is also an _lvalue_. Talk about lunacy. With one stroke, the C++ ``designers'' introduce a whole new batch of nonsense, such as (i = x) = y; which must be rejected by any conforming C implementation as constraint violation. What's the final value of i? Is it x? Or is it y? My friend, do not waste your time: the behavior's undefined. Better C indeed! :)