• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accessing self in a C static function within an implementation definition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Accessing self in a C static function within an implementation definition (From: "email@hidden" <email@hidden>)

  • Prev by Date: Re: Accessing self in a C static function within an implementation definition
  • Next by Date: Re: error details in a NSAlert
  • Previous by thread: Re: Accessing self in a C static function within an implementation definition
  • Next by thread: Bindings for dynamically populated menu
  • Index(es):
    • Date
    • Thread