Le 6 mars 09 à 21:25, Paul Sanders a écrit :

I'd suggest using:
-Wundeclared-selector

j o a r

Excellent.  Thank you.

Of course you can put anything. Else how would you be able to create a
method and a selector at runtime ?

So how does the compiler map any old string to a SEL (which is just a
number)? Is it some kind of hash (in which case how can you be sure it is
unique) or is it something else?  Inquiring minds want to know.

Conceptually:

It defined a selector reference:

SEL * _arbitrary_string_selector;

and then @selector(my_arbitrary_string) is replaced by *_arbitrary_string_selector;

It also generates some data in the __OBJC segment of the binary to tell the objc runtime to initialize the selector pointed by the reference at load time.

@selector() is not considered as a constant value. You cannot use it in static initialization for example (the compiler will report an error).


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to