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=2.1 required=5.0 tests=BAYES_20,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11390f,4c42ac518eba0bbe X-Google-Attributes: gid11390f,public X-Google-Thread: 103376,4c42ac518eba0bbe X-Google-Attributes: gid103376,public X-Google-Thread: 109fba,4c42ac518eba0bbe X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,4c42ac518eba0bbe X-Google-Attributes: gid1014db,public From: Alex Krol Subject: Re: Programming language vote - results Date: 1997/11/23 Message-ID: <34787311.47F8@scitex.com>#1/1 X-Deja-AN: 291758338 References: <343fbb5a.0@news.iprolink.ch> <34466EB4.3381@dynamite.com.au> <6275dt$agm$3@news.on> <344BCED0.2D51@dynamite.com.au> <62tpap$7gh$1@darla.visi.com> <3470EF6E.F74@lysator.liu.se> <64qsf0$ccc@dfw-ixnews11.ix.netcom.com> <347440AD.35DF@idt.net> Reply-To: Alex_Krol@scitex.com Organization: Scitex_Corporation_LTD. Newsgroups: comp.lang.ada,comp.lang.apl,comp.lang.c,comp.lang.c++ Date: 1997-11-23T00:00:00+00:00 List-Id: Terry Richards wrote: > Guys, > As far as I can remember, > neither C or C++ guarantees that the clauses in a condition will be > evaluated in the order you wrote them. IOW, > > if (call_this() || call_that()); > > could compile as if it where written: > > if (call_that() || call_this()); > > which could have different results. No, you are wrong. The Standard guarantees that in (expr1 || expr2) expr2 would be evaluated if and only if expr1 is evaluated to 0; in (expr1 && expr2) expr2 would be evaluated if and onty if expr1 is evaluated to non-zero. To guarantee this, order of evaluation must be guaranteed also. This is true both for C and C++. Regards, Alex Krol