Re: (RS)What's the type of a selector?[2]
Re: (RS)What's the type of a selector?[2]
- Subject: Re: (RS)What's the type of a selector?[2]
- From: Alastair Houghton <email@hidden>
- Date: Sun, 29 Oct 2006 13:34:23 +0000
On Oct 28, 2006, at 7:26 AM, Bill Bumgarner wrote:
On Oct 27, 2006, at 7:24 PM, Roland Silver wrote:
So I gather that a SEL is merely a char*. Que no?
Bill gave rather a long, if very accurate, explanation. SEL values
are made unique by the runtime/linker on OS X. This is why you can
compare the pointer values (which is what you're doing when comparing
SEL values) directly, and the runtime relies on this too for
performance reasons.
The upshot of this is that you *cannot* use a string in place of a
SEL; you must always write @selector(<name of selector>).
Also, Bill's right that you should use the API to get the string
value. I don't know (because I haven't checked) whether casting to
char * still works on the 64-bit ObjC ABI in Leopard, for instance.
It probably does, but using the API means you're guaranteed your code
will work. Relying on implementation details doesn't; even
documented ones sometimes change.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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