Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!digibd!merlyn From: merlyn@digibd (Brian Westley (Merlyn LeRoy)) Newsgroups: comp.lang.c Subject: Re: Odd trivia question involving && and , Keywords: && , if Message-ID: <1990May4.162913.2257@digibd> Date: 4 May 90 16:29:13 GMT References: <1990May2.181709.8988@dasys1.uucp> Organization: DigiBoard Incorporated, St. Louis Park, MN Lines: 25 aj-mberg@dasys1.uucp (Micha Berger) writes: >Do these pieces of source code produce significantly different object >code? 1- > E1 && > E2, > E3; 2- > if (E1) { > E2; > E3; > } I found that many compilers screw up expression (1); E2 would often be evaluated even when E1 is false. They SHOULD produce the same results, but look out when you operate in the real world. A/UX (Apple's Unix) even screwed up E1 && E2 as a standalone statement (it only short-circuited the && in if(), etc, statements). I found this out as part of my obfuscated C code entry for last year. ---- Merlyn LeRoy