• 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: Sending a Selector to another Class.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sending a Selector to another Class.


  • Subject: Re: Sending a Selector to another Class.
  • From: Kyle Sluder <email@hidden>
  • Date: Thu, 22 Oct 2009 09:35:51 -0700

On Oct 22, 2009, at 9:01 AM, Jens Alfke <email@hidden> wrote:

This statement is true; however those integers happen to be the memory addresses of unique instances of the strings*. This makes it very efficient for the runtime to convert a selector to an NSString, and vice versa, and also helps with debugging (in gdb you can just type "print (char*)sel" to inspect a selector.)

Don't forget NSStringFromSelector, which I find is usually more convenient and doesn't rely on implementation details. Invoke it in GDB by casting its return value to id:


po (id)NSStringFromSelector(_cmd)

(Although I have noticed that gdb is much better about inferring when it can expect an object return value from a function/method call).

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Sending a Selector to another Class. (From: Joshua Garnham <email@hidden>)
 >Re: Sending a Selector to another Class. (From: Jim Kang <email@hidden>)
 >Re: Sending a Selector to another Class. (From: Jens Alfke <email@hidden>)
 >Re: Sending a Selector to another Class. (From: Jim Kang <email@hidden>)
 >Re: Sending a Selector to another Class. (From: Bill Bumgarner <email@hidden>)
 >Re: Sending a Selector to another Class. (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Sending a Selector to another Class.
  • Next by Date: Re: Sending a Selector to another Class.
  • Previous by thread: Re: Sending a Selector to another Class.
  • Next by thread: Re: Sending a Selector to another Class.
  • Index(es):
    • Date
    • Thread