Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!mit-eddie!genrad!panda!teddy!jpn From: jpn@teddy.UUCP Newsgroups: comp.lang.c Subject: Re: short circuit evaluation Message-ID: <3721@teddy.UUCP> Date: Wed, 28-Jan-87 17:36:14 EST Article-I.D.: teddy.3721 Posted: Wed Jan 28 17:36:14 1987 Date-Received: Fri, 30-Jan-87 00:47:59 EST References: <425@bobkat.UUCP> <102600001@datacube> <34@umich.UUCP> <14479@amdcad.UUCP> <5199@mimsy.UUCP> Reply-To: jpn@teddy.UUCP (John P. Nelson) Organization: GenRad, Inc., Concord, Mass. Lines: 20 Why is there so much misinformation in this group?!?! I wish people who don't know what they are talking about would not post here! >I can find no promise in K&R that bitwise expressions are not short >circuited even in the presence of side effects. 60 seconds with my copy of K&R yeilds this (Appendix A): "The & operator is associative and expressions involving & may be rearranged" "Unlike &, && guarantees left-to-right evaluation; moreover, the second operand is not evaluated if the first operand is zero" >In any case, I would advise not counting on full evaluation (of bitwise). True, it is not explitly stated that & and | are not short circuited. It also doesn't explicitly say that + and * are not short circuited! However && and || are EXPLICITY defined as having short circuit behavier, no other operators are described this way, so it is safe to assume that all other operators do NOT short-circuit.