This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Token Pasting operator
- From: Neil Booth <neil at daikokuya dot co dot uk>
- To: Srivatsan S <vatsan007 at lycos dot com>
- Cc: gcc at gnu dot org
- Date: Wed, 30 Jul 2003 07:03:05 +0100
- Subject: Re: Token Pasting operator
- References: <BDFPEPNHLGLIBCAA@mailcity.com>
Srivatsan S wrote:-
> Hi,
>
> I have the following piece of code which compiles properly with gcc version 2.95.3, but gives warnings in 3.2.3. This code piece uses token pasting operator in C (##) for string concatenation.
>
>
> #define SETVALUE(x,y) x##y
>
> main()
> {
> char z[20];
> sprintf(z, "%s", SETVALUE("test ", " the program" ));
> printf("z=%s \n", z );
> }
>
> How to compile this successfully on 3.2.3 without warnings?
Remove the ##.
Neil.