Re: Name of current function/selector
Re: Name of current function/selector
- Subject: Re: Name of current function/selector
- From: j o a r <email@hidden>
- Date: Sat, 22 Oct 2005 19:40:43 +0200
On 22 okt 2005, at 19.13, Pontus Ilbring wrote:
There's a macro called __PRETTY_FUNCTION__ that returns the name of
the current function as a cstring.
And let me, for completeness sake, just add that you can access the
selector of the currently executed ObjC method like this:
- (void) someMethod:(id) sender
{
NSLog(@"class: %@, method: %@", NSStringFromClass([self class]),
NSStringFromSelector(_cmd));
}
Doesn't work in plain C functions for obvious reasons.
Note how Apple's assertion macros for ObjC methods and C functions
are different - for exactly this reason. The C variant uses
__PRETTY_FUNCTION__, while the ObjC one uses _cmd.
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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