• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie-Question: Sorting Arrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Re: Newbie-Question: Sorting Arrays (From: Pontus Ilbring <email@hidden>)
 >Re: Newbie-Question: Sorting Arrays (From: "Christoph Lauterbach" <email@hidden>)

  • Prev by Date: NSTableView drags corrupt object graph
  • Next by Date: Help parsing dictionary integer
  • Previous by thread: Re: Newbie-Question: Sorting Arrays
  • Next by thread: Re: Newbie-Question: Sorting Arrays
  • Index(es):
    • Date
    • Thread