On 9 Mar 2008, at 19:18, Stuart Malin wrote:

Thanks Jon and Shem. I spaced out the existence of _cmd and was unaware of __func__

As I best understand their distinction:

        __func__ is generated at compile time (a C-string)

        _cmd is part of the Obj-C runtime (a SEL)

Since I am writing a new method, I can accomplish my goal by passing either _cmd or __func__.

BUT, just out of intellectual curiosity (and possible future need), what if I have existing callers and can't modify their code to pass either of these -- can I still get the identity of the invoking method in my method?
Of course, that would be objc_msgSend.  So... the one before that?
Which leads back to the stack.... and method signatures and frame lengths, and ... I think I'm over my head.

Is there something else simple that I've missed? Or there is documentation somewhere on these mechanics that I should be reading?

Nothing you've missed, there really is no simple way to find this information out without delving into the stack. However, trying to do this is a pretty bad idea on the whole anyway; code that depends on specific other methods calling it like that is probably going to be rather fragile and suggests a weakness in the design.

Mike.
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to