Re: BOOLs, definition of YES
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.