Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!cmcl2!yale!husc6!mit-eddie!genrad!panda!teddy!jpn From: jpn@teddy.UUCP (John P. Nelson) Newsgroups: comp.lang.c Subject: Re: conditional expression evaluation question Message-ID: <3664@teddy.UUCP> Date: Tue, 13-Jan-87 16:43:44 EST Article-I.D.: teddy.3664 Posted: Tue Jan 13 16:43:44 1987 Date-Received: Thu, 15-Jan-87 03:05:25 EST References: <207@rebel.UUCP> Reply-To: jpn@teddy.UUCP (John P. Nelson) Organization: GenRad, Inc., Concord, Mass. Lines: 16 > while (cp < end && triples < MINSKIP) > if ((*cp++ | *cp++ | *cp++) == 0) ++triples; > else triples = 0; Assuming that bitwise OR is really what you wanted, this code fragment will probably break several existing compilers. As for ANSI C, they introduced the concept of sequence-points, at which points all side effects must have taken effect. Sequence-points occur at && || , :? operators (and the end of the expression). There are no sequence points in that bitwise OR expression. To quote the standard (under the ++ operator): "The side effect of updating the stored value of the operand may be delayed until the next sequence point is reached." This says to me that a ANSI conforming C compiler is free to optimize all the increments to the end of the expression if it wishes to. The above code would be unportable.