Re: Introspecting the current method
Re: Introspecting the current method
- Subject: Re: Introspecting the current method
- From: Dave Keck <email@hidden>
- Date: Sun, 18 Apr 2010 15:47:46 -1000
At runtime, I would use:
#define classMethod() (self == [self class])
And just for fun, at compile-time:
GCC:
#define classMethod() (__builtin_choose_expr( \
__builtin_types_compatible_p(__typeof__(self), \
__typeof__(id)), YES, NO))
LLVM:
#define classMethod() (__builtin_choose_expr( \
__builtin_types_compatible_p(__typeof__(self), \
__typeof__(NSObject *)), YES, NO))
Although I don't trust these last two for a second; perhaps a compiler
wizard can comment.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden