Token Pasting operator

Alexandre Oliva aoliva@redhat.com
Wed Jul 30 08:35:00 GMT 2003


On Jul 30, 2003, "Srivatsan S" <vatsan007@lycos.com> wrote:

> #define SETVALUE(x,y)  x##y

>     sprintf(z, "%s", SETVALUE("test ", " the program" ));

You don't want token pasting.  You want string concatenation, that
happens by simply having two strings one after another.  Take out ##
from the macro and it should work.

Note that this question is inappropriate for this forum, that is
devoted to the development *of* GCC, not *with* GCC.  Use
gcc-help@gcc.gnu.org instead, and make sure you read the documentation
and search for the answer to your question on the web before posting
it.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer



More information about the Gcc mailing list