bug-gnustep
[Top][All Lists]
Advanced

[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


From: Richard Frith-Macdonald
Subject: Re: gnustep/2146: call isEqual: to find if a NSString and a NSNumber are equal don't work
Date: Wed, 14 Mar 2001 22:02:41 +0000

On Wednesday, March 14, 2001, at 09:30 PM, mguesdon@orange-concept.com 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 
instances
of private subclasses in a class cluster.

OPENSTEP and MacOS-X behave the same way.



reply via email to

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