[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnustep/2146: call isEqual: to find if a NSString and a NSNumber are
Re: gnustep/2146: call isEqual: to find if a NSString and a NSNumber are equal don't work
Wed, 14 Mar 2001 22:02:41 +0000
On Wednesday, March 14, 2001, at 09:30 PM, address@hidden wrote:
> isEqual: doesn't work to compare a NSString and a NSNumber.
> NSString* a=[NSString stringWithString:@"1"];
> NSNumber* b=[NSNumber numberWIthInti:1];
> [a isEqual:b]] or [b isEqual:a] always return NO
> It's hard to diagnostic until you print the class of the compared objectss
> How does this is handled on NeXT/MacOSX ?
Not a bug ...
This is correct behavior as a string is not a number so isEqual: should always
return NO for a comparison of the two.
In general, objects of different classes are not equal ... unless both are
of private subclasses in a class cluster.
OPENSTEP and MacOS-X behave the same way.
- Re: gnustep/2146: call isEqual: to find if a NSString and a NSNumber are equal don't work,
Richard Frith-Macdonald <=