Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version nyu B notes v1.5 12/10/84; site csd2.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!cmcl2!csd2!berke From: berke@csd2.UUCP (Wayne Berke) Newsgroups: net.lang.c Subject: Re: The wonders of C Message-ID: <3090003@csd2.UUCP> Date: Thu, 21-Mar-85 21:47:00 EST Article-I.D.: csd2.3090003 Posted: Thu Mar 21 21:47:00 1985 Date-Received: Sat, 23-Mar-85 03:05:09 EST References: <967@dual.UUCP> Organization: New York University Lines: 18 > > > I was reading Creative Computing when I saw the most bogus C programming > > > example. The author was comparing C to Basic- > > > Basic: if A=1 and B=1 goto 104950393040 [:-> > > > C: if (A==1 & B==1) foobar(); > > > Which works, of course, but it was clear from the context that the author > > > thought that '&' and logical AND were identical!!!! -- Mark Roddy > > > > It doesn't work if A == 1 and B == 3. It calls foobar when it shouldn't. It sure does work. It simplifies to if (1==1 & 3==1) foobar() if (TRUE & FALSE) foobar() if (0x1 & 0x0) foobar() if (FALSE) foobar() So foobar is correctly not invoked.