• 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
Difference between SEL and const char* when sending a message?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Difference between SEL and const char* when sending a message?


  • Subject: Difference between SEL and const char* when sending a message?
  • From: Daqi Pei <email@hidden>
  • Date: Wed, 8 Apr 2009 11:34:32 +0800

Hi everyone. I'm new to Objective-C but I've been working with C++ for
years. I'm trying to understand how the selector mechanism works.
So far it seems to me that SEL is simply a wrapper for 'const char*', Obj-C
compiler maintains a table of all method name - method function pointer
pairs and pick up one according to the object you passed to the call. (Sorry
for my C++ semasiology)

My hypothesis works well with method calls with no parameters. e.g. , you
cal write:

[myObj performSelector: (SEL)"someMethod"];

Though when it comes to method with parameters, it looks like a total
different story.

NSSelectorFromString(); works fine, but the approach above throws
exceptions.

Anyone knows why? Thanks.

Regards,
DairyKnight
_______________________________________________

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

  • Follow-Ups:
    • Re: Difference between SEL and const char* when sending a message?
      • From: Marcel Weiher <email@hidden>
    • Re: Difference between SEL and const char* when sending a message?
      • From: Michael Ash <email@hidden>
    • Re: Difference between SEL and const char* when sending a message?
      • From: Mark Ritchie <email@hidden>
    • Re: Difference between SEL and const char* when sending a message?
      • From: Graham Cox <email@hidden>
  • Prev by Date: Fully transparent window opaque to mouse?
  • Next by Date: Re: Difference between SEL and const char* when sending a message?
  • Previous by thread: Re: Fully transparent window opaque to mouse?
  • Next by thread: Re: Difference between SEL and const char* when sending a message?
  • Index(es):
    • Date
    • Thread