• 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: BOOLs, definition of YES
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BOOLs, definition of YES


  • Subject: Re: BOOLs, definition of YES
  • From: Greg Hurrell <email@hidden>
  • Date: Wed, 21 May 2003 00:10:06 +0930

El Tuesday, 20 May, 2003, a las 23:31 Australia/Adelaide, Tom Sutcliffe escribis:

I'm therefore interested in how best to go about inverting a BOOL variable. I stuck with

flag = (flag ? NO : YES);
// flag = 1 - flag would also work but is even less clear

How about a macro?

#define INVERT(boolValue) (boolValue ? NO : YES)

Then you could use:

flag = INVERT(flag);

Which is more readable... You could even use NOT instead of INVERT as your macro name, I think.

eg. flag = NOT(flag);

Cheers
Greg
_______________________________________________
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: 
 >BOOLs, definition of YES (From: Tom Sutcliffe <email@hidden>)

  • Prev by Date: Re: NSRectFill not supporting compositing?????
  • Next by Date: Re: BOOLs, definition of YES
  • Previous by thread: Re: BOOLs, definition of YES
  • Next by thread: Re: BOOLs, definition of YES
  • Index(es):
    • Date
    • Thread