------- Comment #1 from neil at daikokuya dot co dot uk  2006-11-14 22:49 
-------
Subject: Re:   New: Concatenation operator ## doesn't work with this:  / ## /

michael dot bishop at gdcanada dot com wrote:-

> I am trying to use the macro concatenation operator to make a "conditional
> comment".  I want a symbol that I can sprinkle throught my C code that will be
> replaced either be a C++ style // comment, or it will be replaced with 
> nothing.

There is no such thing as a conditional comment.  Only Microsoft's
preprocessor, broken in many ways, seems to support this (and those
compilers that attempt to emulate MS).  This has been discussed before;
GCC will never support this.

> The compiler error messages are:
> 
>   t.c:8:1: pasting "/" and "/" does not give a valid preprocessing token
>   t.c:10:1: pasting "/" and "/" does not give a valid preprocessing token

This is correct.

> The output from the preprocessor (using the -E command line switch) is:
> 
>   int
>   main ( void )
>   {
>     int i ;
>     / / int j ;
> 
>     / / j = i ;
> 
>     return ( 0 ) ;
>   }
> 
> I find it strange that the preprocessor puts a blank space between the two '/'
> characters.  This looks like a bug to me.  I don't think there should be a
> blank space between the characters.

It's because the preprocessor is taking care to avoid creating something
that looks like a comment, from two separate tokens.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29836

Reply via email to