Re: Comparing Selectors

Richard Frith-Macdonald <[email protected]>
Newsgroups gmane.comp.lib.gnustep.user
Message-ID <5671b7027a0d0d50b20f3b4535ae41bb@blackbox>
On 2005-08-05 10:18:58 +0100 Sašo Kiselkov <[email protected]> wrote:

> 
> I have an issue with comparing selectors. Trouble is, the GNU Objective-C
> runtime tells me that SEL's are pointers to struct objc_selector and that they
> themselves may not be unique, and the correct way to compare them is by doing:
> 
> sel1->sel_id == sel2->sel_id
> 
> However, Apple forums and according to what I read about the Apple Objective-C
> runtime, doing just
> 
> sel1 == sel2
> 
> is perfectly fine and that the uniqueness of both selectors is ensured.
> 
> So please, can anybody tell me what is the correct, civilized and portable way
> of doing it?

Use the sel_eq() macro to compare selectors.
This is defined in the gnu runtime headers, and also in one of the gnustep base compatibility headers for apple.
With the apple compiler/runtime sel_eq(A,B) is equivalent to (A == B)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.