Re: Newbie-Question: Sorting Arrays
Re: Newbie-Question: Sorting Arrays
- Subject: Re: Newbie-Question: Sorting Arrays
- From: Ondra Cada <email@hidden>
- Date: Fri, 10 Jun 2005 18:49:50 +0200
Christoph,
On 10.6.2005, at 16:32, Christoph Lauterbach wrote:
By building the app, I get the following warnings:
Record.m:105: warning: multiple declarations for method `compare:'
/.../NSValue.h:53: warning: using `-(NSComparisonResult)compare:
(NSNumber
*)otherNumber'
/.../NSDate.h:29: warning: also found `-
(NSComparisonResult)compare:(NSDate *)other'
/.../NSString.h:72: warning: also found `-
(NSComparisonResult)compare:(NSString *)string'
How can I determine the function it uses?
You don't need to, the runtime does (properly). Nevertheless, if you
want to (to get rid of the ugly warning), tell the compiler that is
indeed is an NSString what is being compared:
return [(NSString*)[ ... ] compare:[ ... ]];
This harmless, but kinda ugly compile-time ambiguity is one of a
small number of known design flaws in OpenStep (today Cocoa). The
compare: argument should be always id, and there might be methods
"compareToNumber:" etc., with appropriate argument types.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden