[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with +numberWithBool: ?
From: |
Manuel Guesdon |
Subject: |
Problem with +numberWithBool: ? |
Date: |
Thu, 29 Jan 2004 13:24:06 +0100 (CET) |
Hi,
+numberWithBool: is defined as:
+ (NSNumber*) numberWithBool: (BOOL)value
{
if (value == YES)
{
return boolY;
}
else
{
return boolN;
}
}
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 suggest:
+ (NSNumber*) numberWithBool: (BOOL)value
{
if (value == NO) // NO is always 0 but YES is a value != 0
{
return boolN;
}
else
{
return boolY;
}
}
Manuel
--
______________________________________________________________________
Manuel Guesdon - OXYMIUM <address@hidden>
14 rue Jean-Baptiste Clement - 93200 Saint-Denis - France
Tel: +33 1 4940 0999 - Fax: +33 1 4940 0998
- Problem with +numberWithBool: ?,
Manuel Guesdon <=
- Re: Problem with +numberWithBool: ?, Richard Frith-Macdonald, 2004/01/29
- Re: Problem with +numberWithBool: ?, David Ayers, 2004/01/29
- Re: Problem with +numberWithBool: ?, Alexander Malmberg, 2004/01/29
- Re[2]: Problem with +numberWithBool: ?, Manuel Guesdon, 2004/01/29
- Re: Problem with +numberWithBool: ?, Helge Hess, 2004/01/30
- [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?), Alexander Malmberg, 2004/01/30