• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C question for you old guys ;-)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: C question for you old guys ;-) (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: C question for you old guys ;-)
  • Next by Date: Re: Dragging Rect
  • Previous by thread: Re: C question for you old guys ;-)
  • Next by thread: Re: C question for you old guys ;-)
  • Index(es):
    • Date
    • Thread