Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!dayton!viper!john From: john@viper.UUCP Newsgroups: comp.lang.c Subject: Re: short circuit evaluation Message-ID: <520@viper.UUCP> Date: Thu, 12-Feb-87 17:59:24 EST Article-I.D.: viper.520 Posted: Thu Feb 12 17:59:24 1987 Date-Received: Fri, 13-Feb-87 22:00:22 EST References: <4389@brl-adm.ARPA> Reply-To: john@viper.UUCP (John Stanley) Organization: DynaSoft Systems Lines: 20 Summary: short circuit of '|' and '&' = "standardized bugs" I agree totaly with Dan Hoey's statement on this subject. There is -FAR- too much code already existing which requires non-shortcircuit evaluation of '|' and '&' operations. Since one of the primary considerations that has been stated by the standards committee was to avoid "breaking" as much existing software as possible, and since, as Dan pointed out, "a standard which is silent on this point is no standard", it seems that at very least all side effects -must- be carried out. As long as the code produces the same results, I doubt any of us will object if the compiler creates some bizarre method of getting things done in the least amount of time. What this means to me is that code written in optimized C, where side effects are known and taken into account, won't break just because some tight loop got short circuited and an increment got skipped. This kind of code exists -everywhere-. If we allow side effects like increment or function calls to be skipped in one "optimized" compiler and not in the standard run-of-the-mill type complers that most of us use, the standard itself will have introduced portability problems by an omission... If the compiler people want to create code which stops evaluating the results after a fixed result is known, I say fine. BUT, they must take the responsibilty of picking up the peices and making sure the incidental increments,etc are taken care of!