Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!csd4.csd.uwm.edu!andrew From: andrew@csd4.csd.uwm.edu (Andy Biewer) Newsgroups: comp.lang.c Subject: if ( x && y ) or if ( x ) then if ( y ) ... Message-ID: <5781@uwm.edu> Date: 17 Aug 90 02:51:09 GMT Sender: news@uwm.edu Reply-To: andrew@csd4.csd.uwm.edu (Andy Biewer) Distribution: usa Organization: UWM - Computing Services Division Lines: 22 Much of the time during programming in C I run into the same question about conditional statements such as the subject. I have been wondering for quite some time now about what, if any, differences there are between the two conditional statements: 1) if ( x && y ) statement; 2) if ( x ) if ( y ) statement; It may be a trivial question, however, is there any? Will `y' in the first conditional be tested if `x' fails? I know that it won't in the second. Because it's a conjunction, logically it is unnecessary to test `y' because the whole evaluation is false if `x' fails. And, of course, with a disjunction it would be necessary to test `y'. But, is the compiler smart enough to take these facts into consideration (or is it even possible to)? Andy B.