[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New warnings (hopefully) in gcc 3.4

From: Alexander Malmberg
Subject: Re: New warnings (hopefully) in gcc 3.4
Date: Tue, 02 Sep 2003 01:29:21 +0200

David Ayers wrote:
> and we always declare
> -(NSComparisonResult)compare:(id)o;
> where all classes implementing a "concrete"
> -(NSComparisonResult)compareToXXX:(NSXXX *)o;
> must implement:
> -(NSComparisonResult)compare:(id)o;
> to call the corresponding:
> -(NSComparisonResult)compareToXXX:(NSXXX *)o;
> (with an applicable cast)

A cast isn't enough. It needs to check that the other object is of the
correct class (or at least some compatible class) and fall back to some
other comparison if it isn't. Object address, like NSObject? Compare
class names?

> The precedance to this is isEqual(ToXXX):.  Yet as Apple's API does not
> implement these, we need to implement the:
> -(NSComparisonResult)compareToXXX:(NSXXX *)o;
> in GSCompatibility.m
> to call
> -(NSComparisonResult)compare:(NSXXX)o;
> If I can get some yea's on this, I can prepare a patch.

I think it looks good, although the -compareToXXX: may be overkill
unless someone really needs the extra performance it gives.

- Alexander Malmberg

reply via email to

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