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 (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