Quoting David Ayers <[EMAIL PROTECTED]>:

> Sašo Kiselkov schrieb:
> > 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?
>
> Indeed, for the Apple/NeXT Objective-C runtime selector equality can
> determined by pointer comparison yet this does not work for the GNU
> Objective-C runtime due to the notion of "typed selectors".  The
> canonical way to portably compare selectors is to use
>
> BOOL sel_eq (SEL s1, SEL s2)
>
> which is actually a GNU Objective-C runtime function but GNUstep defines:
>
> #define sel_eq(s1, s2)                  (s1 == s2)
>
> for the Apple/NeXT Objective-C runtime in GNUstepBase/objc-gnu2next.h
> which is included by GNUstepBase/GSObjCRuntime.h.  This last header
> contains various functions to help abstract the differences between the
> two runtimes, and is probably the header you want to include.  (Note
> that not all mappings in objc-gnu2next.h really work smoothly due to
> slightly differing semantics.)
>
> Cheers,
> David Ayers
>

I see. Thanks, problem solved then. :-)

Regards
 Saso



_______________________________________________
Help-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnustep

Reply via email to