• 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: Macro to output an NSString containing function name, line number plus a string with a variable number of arguments?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Laurent Daudelin <email@hidden>
  • Date: Tue, 17 Apr 2012 16:01:46 -0700

You're probably right, Christiaan, as it doesn't work any better.

So, how would a macro like this be written?

-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 				http://www.nemesys-soft.com/
Logiciels Nemesys Software					email@hidden

On Apr 17, 2012, at 15:51, Christiaan Hofman wrote:

>
> On Apr 18, 2012, at 0:36, Marco S Hyman wrote:
>
>>>
>>> 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
>
> Apart from that, a "return" in a macro is almost certainly not what you want. A macro is not a function in any way.
>
> Christiaan
>
>


 _______________________________________________
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

  • Follow-Ups:
    • Re: Macro to output an NSString containing function name, line number plus a string with a variable number of arguments?
      • From: Wim Lewis <email@hidden>
References: 
 >Macro to output an NSString containing function name, line number plus a string with a variable number of arguments? (From: Laurent Daudelin <email@hidden>)
 >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>)
 >Re: Macro to output an NSString containing function name, line number plus a string with a variable number of arguments? (From: Christiaan Hofman <email@hidden>)

  • Prev by Date: Re: Macro to output an NSString containing function name, line number plus a string with a variable number of arguments?
  • Next by Date: Re: Macro to output an NSString containing function name, line number plus a string with a variable number of arguments?
  • Previous by thread: Re: Macro to output an NSString containing function name, line number plus a string with a variable number of arguments?
  • Next by thread: Re: Macro to output an NSString containing function name, line number plus a string with a variable number of arguments?
  • Index(es):
    • Date
    • Thread