(RS)What's the type of a selector?[3]
(RS)What's the type of a selector?[3]
- Subject: (RS)What's the type of a selector?[3]
- From: Roland Silver <email@hidden>
- Date: Fri, 27 Oct 2006 21:05:45 -0600
On Oct 27, 2006, at 8:30 PM, Chris Suter wrote:
Hi,
Looks like you should read some C books.
It's a pointer to an structure.
It's not a char * and NSLog ("%s", @selector (foo)) will not work
as someone suggested earlier.
Either use %p for a pointer or use %s with sel_getName or use %@
and NSStringFromSelector.
This is all in the documentation and you really don't need us to
help you.
- Chris
Well, Chris...
First: I've read Kernighan/Ritchie and Harbison/Steele; will they do?
Second: I'm sure there isn't a book on C that talks about @selector
or NSLog, which are Cocoa features, not C features.
Third, NSLog ("%s", @selector (foo)) DOES work, as Aaron Hillegass
suggested: try it for yourself; I did! Here ya go:
@implementation type
- (void)awakeFromNib {
NSLog(@"%s", @selector(awakeFromNib));
}
@end
That is the important part of a project that compiles and runs. The
result from the run log is:
[Session started at 2006-10-27 20:46:42 -0600.]
2006-10-27 20:46:43.246 selectorType[1489] awakeFromNib
Fourth: It doesn't look to me like @selector is a pointer to a struct
(if that's what you meant), it looks like a pointer-to-char, i.e. a C-
string.
Fifth: Thanks for telling me that it's "all in the documentation" and
I don't need the list members to help me. I searched around at length
in the "documentation" before putting my question to the list, but
didn't find the answer anywhere I looked.
--Roland Silver <email@hidden>
--------------------------------------
_______________________________________________
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