|
From: | Helge Hess |
Subject: | Re: Re[2]: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?) |
Date: | Mon, 2 Feb 2004 02:06:21 +0100 |
On 31.01.2004, at 13:55, Manuel Guesdon wrote:
OK, we can write [NSNumber numberWithBool:(isupper(SomeChar) ? YES : NO)] but it's not the first thing I'll write (I'll begin with: [NSNumber numberWithBool:isupper(SomeChar)]) so I'llget sooner or later an exception, may be not reproductible.Now, if BOOL is a real BOOL (i.e. it will transform all non zero value to 1), it's OK but in this case, there's no needto handle not (0|1) case as it never occur....
The funny thing is that the code would not change at all for real BOOLs! Even with real BOOLs the check would be written as
if (bool) *never* if (bool == YES)So for checking conditions Richards code does nothing but break code and increase bloat on the callsite (which you have shown very well in your isupper sample).
Greets, Helge -- http://docs.opengroupware.org/Members/helge OpenGroupware.org
[Prev in Thread] | Current Thread | [Next in Thread] |