To correct for typos, and to add the issue I’m having which I forgot to mention, here is the macro:
#define SUFFIX .new
#define STR(x) #x
#define GENFILE(name,suff) STR(timings/name suff)
GENFILE(test1, SUFFIX)
The above code generates timings/test1 .new and if only I didn’t have that extra space, I would have what I want, how do I get around that?
There is no single token (call it “word” if you like)
/test1./test1is the division operator/followed by the identifiertest1, and they cannot be added together. Luckily, you don’t need to. If they appear together without any intervening spaces, and you stringize it, no space gets inserted. So just remove the##.Also make sure your macro parameter name matches what you use in the definition.
testnameandnameare not the same.Update:
Since you’ve edited your question, the above is no longer a complete answer.
You get the space because you included a space in the macro definition, and you need to rewrite your macro definition to not include a space. One way to do it is with an extra macro like this:
Note that the
STRmacro now needs an extra helper macro too, to allowIDto get expanded before including it in the string.