Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/3/84; site enmasse.UUCP
Path: utzoo!watmath!clyde!cbosgd!ihnp4!mhuxn!mhuxj!mhuxr!ulysses!allegra!mit-eddie!godot!harvard!talcott!panda!enmasse!mroddy
From: mroddy@enmasse.UUCP (Mark Roddy)
Newsgroups: net.lang.c
Subject: Re: Is this bogus or what?
Message-ID: <365@enmasse.UUCP>
Date: Thu, 7-Mar-85 15:24:23 EST
Article-I.D.: enmasse.365
Posted: Thu Mar  7 15:24:23 1985
Date-Received: Sat, 9-Mar-85 08:39:49 EST
References: <1556@ritcv.UUCP> <155@cci-bdc.UUCP> <362@enmasse.UUCP> <7026@watdaisy.UUCP>
Distribution: net
Organization: Enmasse Computer Corp., Acton, Mass.
Lines: 36

> > 	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.
 
	from K&R:

		"Note that the precedence of the bitwise logical operators
		&,^ and | falls below == and !=."
									pp. 49 The C Programming Language

	The order of evaluation is ((A==1) & (B==1)), for (A,1), (B,3),
	your compiler should evaluate ( (1) & (0) ) to be 0.

	[short pause here while the author determines, through a
		small experiment, if he is talking through his hat
		yet again.]

	[okay, we`re back, ego intact. K&R and moi all agree on what C is]

	I do stand corrected however, the Creative Computing article
	read ((A==1) & (B==1)). 

	The point really was about the utter crapola that goes out in
	some of the home computer rags.

	If your compiler behaves the way you suggest, I'd send it back.

-- 
						Mark Roddy
						Net working,
						Just reading the news.

					(harvard!talcott!panda!enmasse!mroddy)