|
From: | Richard Frith-Macdonald |
Subject: | Re: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?) |
Date: | Mon, 2 Feb 2004 19:43:17 +0000 |
On 02.02.2004, at 15:17, Richard Frith-Macdonald wrote:
Until someone (you?) found a reference in apple documentation warning that boolValue might return a non-YES/NO value from an NSNumber, I'd have said that yes, we are entitled to insist on correct usage of BOOL.
We are not talking about return values!
I think we pretty much agree that a -(BOOL)boolValue *should* return YES or NO (I wouldn't go as far and claim that it must).
Cocoa reference says:
"+ (NSNumber *)numberWithBool:(BOOL)value
Creates and returns an NSNumber containing value, treating it as a BOOL"
Which doesn't help. But to end this ridiculous discussion I tried on Panther:
NSLog(@"Hello, World!: %@", [NSNumber numberWithBool:5]);
gives
2004-02-02 19:52:35.633 BoolTest[4187] Hello, World!: true
[Prev in Thread] | Current Thread | [Next in Thread] |