Re: Accessing self in a C static function within an implementation definition
Re: Accessing self in a C static function within an implementation definition
- Subject: Re: Accessing self in a C static function within an implementation definition
- From: Quincey Morris <email@hidden>
- Date: Mon, 07 Apr 2014 09:51:14 -0700
On Apr 7, 2014, at 03:00 , email@hidden wrote:
> I have a function like macro:
>
> #define DBDispatchMonoEvent(KLASS, NAME) \
> do { \
> [DBManagedEvent dispatchEventFromMonoSender:monoSender \
> eventArgs:monoEventArgs \
> targetClass:[KLASS class] \
> targetSelectorName: NAME]; \
> } while (NO);
On a side note:
I hope this isn’t actually your macro, because it has a bug — there shouldn’t be a semicolon at the end. In fact, the whole *point* of the ‘do…while(0)’ trick is to avoid having the terminating semicolon in the macro.
There is some discussion of what can go wrong here, for example:
http://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html
_______________________________________________
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