Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ObjC BOOL and boolean c expressions



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.