Re: Macro to output an NSString containing function name, line number plus a string with a variable number of arguments?
Re: Macro to output an NSString containing function name, line number plus a string with a variable number of arguments?
- Subject: Re: Macro to output an NSString containing function name, line number plus a string with a variable number of arguments?
- From: Marco S Hyman <email@hidden>
- Date: Tue, 17 Apr 2012 15:36:44 -0700
>
> So far, my latest try is this:
>
> #define FileLog(format, ...) {\
> return [NSString stringWithFormat:@"\n %s [Line %d] \n %@", __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:(format), ##__VA_ARGS__]];\
> }
>
Change that to something that looks like a statement. One that you
can add a ; to is even better. The "standard" way to do that is
#define FileLog(format, ...) do { \
return [NSString stringWithFormat:@"\n %s [Line %d] \n %@", \
__PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:(format), \
##__VA_ARGS__]]; } while (0)
Marc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden