• 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
How is @selector resolved at compile time ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How is @selector resolved at compile time ?


  • Subject: How is @selector resolved at compile time ?
  • From: "Erik M. Buck" <email@hidden>
  • Date: Wed, 25 Jul 2001 21:53:05 -0500

Suppose I have several different frameworks that all use a particular selector
via @selector(someSelector). How do the compiler and runtime make sure that
@selector(someSelector) always results in the same value (pointer) in separate
compilation units in separate frameworks ? Are selector values that result
from @selector somehow fixed-up when a framework is loaded ? They would have
to be to make sure that all frameworks in a running application have the same
value for the same selector. How could that fix-up be implemented ? Does
every occurrence of @selector result in a lookup at run-time each time it is
encountered ?


if I write the following:

int i;

for(i = 0; i < 10000; i++) {
[NSObject performSelector:@selector(description)];
}

Is the value of @selector(description) looked up 10000 times or once or not at
all because the compiler took care of it ?


  • Follow-Ups:
    • Re: How is @selector resolved at compile time ?
      • From: Chris Kane <email@hidden>
    • Re: How is @selector resolved at compile time ?
      • From: "Erik M. Buck" <email@hidden>
  • Prev by Date: Re: Obj-C vs Java
  • Next by Date: Re: Color/Number List
  • Previous by thread: Re: Color/Number List
  • Next by thread: Re: How is @selector resolved at compile time ?
  • Index(es):
    • Date
    • Thread