On Apr 18, 2010, at 9:21 PM, Michael Ash wrote: > On Sun, Apr 18, 2010 at 10:15 PM, Dave DeLong <davedel...@me.com> wrote: >> Yes, code should obviously be written with this knowledge in mind. The use >> case I have for it is for macros. I like to use a debugging macro like the >> following to ensure that methods are getting called (without having to break >> execution to stop at a breakpoint): >> >> #define LogMethod NSLog(@"-[%@ %...@]", NSStringFromClass([self class]), >> NSStringFromSelector(_cmd)) >> >> This, of course, is only accurate for instance methods (since I'm logging a >> "-"). I was just wondering if there was a way I could use some sort of >> introspection to appropriately place a + or a -. >> >> I like the ([self class] == self) method, simply because it's shorter, but >> the [[self class] instancesRespondToSelector:_cmd] is also a great solution. > > The magic __func__ identifier produces a C string which I believe, in > an ObjC method, has exactly the format you're looking for.
And, if not, then one of __FUNCTION__ or __PRETTY_FUNCTION__ probably does. Cheers, Ken _______________________________________________ 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