• 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
ObjC BOOL and boolean c expressions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ObjC BOOL and boolean c expressions


  • Subject: ObjC BOOL and boolean c expressions
  • From: Eyal Redler <email@hidden>
  • Date: Fri, 31 Aug 2007 08:30:31 +0300

Hi,

I'm not sure where and when but I recall reading something about ObjC BOOL type values YES and NO not being the same as whet a boolean expression might produce.
I can't recall the exact details but there was some kind of gotcha related to this. For example, the expression


BOOL myBool=(myInt==1);

might set myBool differently then

BOOL myBool=(myInt==1)?YES:NO;

Or maybe it was that

if (myBool)
	[foo bar];

will perform differently then
if (myBool==YES)
	[foo bar];

Or maybe it was just that if I do this

int myInt=4096;
BOOL myBool=myInt;

Then if (myBool) will evaluate to false.

This issue was bugging me for quite some time and I'm wondering if somebody recalls this discussion.

TIA


Eyal Redler ====================================== RedleX - Makers of Mellel www.mellel.com email@hidden email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: ObjC BOOL and boolean c expressions
      • From: "Clark Cox" <email@hidden>
    • Re: ObjC BOOL and boolean c expressions
      • From: Charles Steinman <email@hidden>
  • Prev by Date: Re: The magic of Key Value Coding and Key Value Observing
  • Next by Date: Re: The magic of Key Value Coding and Key Value Observing
  • Previous by thread: Re: Finding definitions
  • Next by thread: Re: ObjC BOOL and boolean c expressions
  • Index(es):
    • Date
    • Thread