Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!lll-lcc!well!msudoc!crlt!michael From: michael@crlt.UUCP Newsgroups: comp.lang.c Subject: Re: short circuit evaluation Message-ID: <650@crlt.UUCP> Date: Sat, 21-Feb-87 16:21:49 EST Article-I.D.: crlt.650 Posted: Sat Feb 21 16:21:49 1987 Date-Received: Mon, 23-Feb-87 02:48:25 EST References: <425@bobkat.UUCP> <102600001@datacube> <7610@utzoo.UUCP> Organization: CRLT , Ann Arbor, MI Lines: 36 Summary: Hooray for X3J11. [Line eater shouldn't eat: no leading whitespace - but why take chances?] In article <7610@utzoo.UUCP>, henry@utzoo.UUCP writes: > > I should add that X3J11 has come down quite firmly on the pragmatic side > of this issue. With the obvious exceptions of && and friends, which are > explicitly short-circuited, the compiler is not permitted to leave out > side effects of expressions. Let me applaud X3J11 on this issue. Regardless of whether side-effects are allowed to be optimized out or not, conforming compilers should all do things predictable from the standard. Thus they should all either squeeze them out or not. Otherwise you can all-too-easily write code that works with some conforming compilers and not others - which is exactly what a standard is intended to prevent, or at least reduce and make it easy to avoid. When a programmer writes a statement with side-effects, it is probably because he wanted them to happen. Therefore, the logical choice is to force the compiler to let them happen, rather than to force it to squeeze them out. (In the same vein, perhaps my biggest objection to c is the possibility that associative operators may be rearranged, even if I try to coerce the order with parenthesis. This means that if, say, I want to coerce multiplies and divides into a certain order to insure against overflow, I must break expressions into several statements.) =========================================================================== "I've got code in my node." | UUCP: ...!ihnp4!itivax!node!michael | AUDIO: (313) 973-8787 Michael McClary | SNAIL: 2091 Chalmers, Ann Arbor MI 48104 --------------------------------------------------------------------------- Above opinions are the official position of McClary Associates. Customers may have opinions of their own, which are given all the attention paid for. ===========================================================================