gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with +numberWithBool: ?


From: David Ayers
Subject: Re: Problem with +numberWithBool: ?
Date: Thu, 29 Jan 2004 14:46:31 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113

Richard Frith-Macdonald wrote:


On 29 Jan 2004, at 12:24, Manuel Guesdon wrote:


So as far as I understand [NSNumber numberWIthBool:2] will return boolN which is wrong as 2 is TRUE, isn't it ? (Or may
I need some sleep ? :-)


I agree it'll return boolN ... but 2 is not YES
Booleans in objc can be YES or NO ... this is not the same thing as true/false in C/ObjC conditionals where 0 is false and anything non-zero is true.


Checking the online docs:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSNumber.html#//apple_ref/doc/initWithBool_

I read:
boolValue:
...
*Note: *The value returned by this method isn’t guaranteed to be one of |YES| or |NO|. A 0 value always means |NO| or false, but any nonzero value should be interpreted as |YES| or true.

Cheers,
David






reply via email to

[Prev in Thread] Current Thread [Next in Thread]