macro question

bruce.labitt at autoliv.com bruce.labitt at autoliv.com
Thu Oct 8 15:21:18 EDT 2009


Thomas Charron <twaffle at gmail.com> wrote on 10/08/2009 01:29:06 PM:

> On Thu, Oct 8, 2009 at 1:26 PM, Thomas Charron <twaffle at gmail.com> 
wrote:
> > On Thu, Oct 8, 2009 at 9:36 AM,  <bruce.labitt at autoliv.com> wrote:
> >> In a file system_file_ops.c that is in the psocket library there is 
the
> >> statement
> >> #define wrap(f) wrap_#f
> >> I think this is supposed to do
> >> wrap(read)( .... )  ==> wrap_read( .... )
> >> Are there circumstances when this does not work?  C89, C99, ???
> >  Isn't it supposed to be double #?
> > #define wrap(f) wrap_##f
> 
>   Confirmed:
> 
> The single '#' character means Stringify the following value - a.k.a
> to put in double-quotes.
> The double '##' characters means to Token-join.
> 
> Example File 1:
>     #define wrap(f) wrap_#f
>     wrap(read)
> Preprocessed output (gcc -E <testfile.c>)
>     wrap_ "read"
> 
> Example File 2:
>     #define wrap(f) wrap_##f
>     wrap(read)
> Preprocessed output (gcc -E <testfile.c>)
>     wrap_read
> 
> -- 
> -- Thomas

Thanks for confirming that.  Out of curiousity - see Shawn's comment to 
psocket build problems, what is the version of gcc that you used?

-Bruce


******************************
Neither the footer nor anything else in this E-mail is intended to or constitutes an <br>electronic signature and/or legally binding agreement in the absence of an <br>express statement or Autoliv policy and/or procedure to the contrary.<br>This E-mail and any attachments hereto are Autoliv property and may contain legally <br>privileged, confidential and/or proprietary information.<br>The recipient of this E-mail is prohibited from distributing, copying, forwarding or in any way <br>disseminating any material contained within this E-mail without prior written <br>permission from the author. If you receive this E-mail in error, please <br>immediately notify the author and delete this E-mail.  Autoliv disclaims all <br>responsibility and liability for the consequences of any person who fails to <br>abide by the terms herein. <br>
******************************



More information about the gnhlug-discuss mailing list