• 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: (RS)What's the type of a selector?[2]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: (RS)What's the type of a selector?[2]
      • From: David Duncan <email@hidden>
References: 
 >What's the type of a selector? (From: Roland Silver <email@hidden>)
 >Re: What's the type of a selector? (From: John Stiles <email@hidden>)
 >(RS)What's the type of a selector?[2] (From: Roland Silver <email@hidden>)
 >Re: (RS)What's the type of a selector?[2] (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: App menubar dead
  • Next by Date: Re: App menubar dead
  • Previous by thread: Re: (RS)What's the type of a selector?[2]
  • Next by thread: Re: (RS)What's the type of a selector?[2]
  • Index(es):
    • Date
    • Thread