Re: C question for you old guys ;-)
Re: C question for you old guys ;-)
- Subject: Re: C question for you old guys ;-)
- From: "Clark S. Cox III" <email@hidden>
- Date: Wed, 11 Jun 2003 15:22:24 -0400
On Wednesday, Jun 11, 2003, at 14:10 US/Eastern, John C. Randolph wrote:
On Wednesday, June 11, 2003, at 08:48 AM, Andy Lee wrote:
At 11:43 AM -0700 6/9/03, John C. Randolph wrote:
When I write
#define is ==
#define and &&
#define or ||
#define until(a) while(!(a))
Out of curiosity -- do you also use...
#define not !
No I don't. Since there's no '!!' operator, there's no hazard there
of typos that compile.
Just to play devil's advocate. Yes there is a hazard, and it is the
same as with '=' vs. '=='. Consider the following code:
if(!!a) /*instead of if(!a)*/
{
/*
This will compile just fine, but will produce results
that are exactly opposite of what the programmer intended
*/
}
So, if '#define is ==' is useful, then '#define not !' is useful for
the exact same reason. If '#define not !' is not useful, then neither
is '#define is ==', for the same reason.
--
http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.