Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site dual.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!dual!paul From: paul@dual.UUCP (Baker) Newsgroups: net.lang.c Subject: Re: The wonders of C Message-ID: <967@dual.UUCP> Date: Mon, 18-Mar-85 16:21:06 EST Article-I.D.: dual.967 Posted: Mon Mar 18 16:21:06 1985 Date-Received: Wed, 20-Mar-85 03:50:37 EST References: <1556@ritcv.UUCP> <155@cci-bdc.UUCP> <362@enmasse.UUCP> <7026@watdaisy.UUCP> Distribution: net Organization: Dual Systems, Berkeley, CA Lines: 17 > > 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. But then the whole point of C is to make it easy to commit errors which superficially look correct, compile without a whimper and yet are totally wrong. For example "if (X!=1)" ... compiles just as well as "if (x|=1)". On many terminals "|" and "!" are almost indistinguishable. "if (x<>1) would have been incredibly easier to understand, but, oh no, other people had used this and so was obviously unacceptable. Paul Wilcox-Baker.