Original Post
How can I change the way the following behaves
#define DEF something
#define AMACRO(a,b) a ## b
#define SOMTHING AMACRO(DEF,"1");
now I know the above is pretty pointless but what I want to happen is SOMETHING==something1 but instead I get SOMETHING=DEF1 because the ##(concat) is happening before DEF gets resolved to something.
What I am actually trying to do is the following:
There is a define which I can not alter and it exists as follows:
#define NAME somename
now I want to include the file like so
#include "somename_suffix"
where somename is got from the define NAME. The problem is that in order to do
#include NAME"_suffix"
NAME has to be defined like so
#define NAME "somename"
Which for my own reasons is just NOT possible.
I tried something like this
#define addquotes(a) #a
#include QNAME addquotes(NAME)
#include QNAME"_suffix"
but the results are as follows:
#include "NAME""_suffix"
which is the same as
#include "NAME_suffix"
which is WRONG!
Is there a way I can tell the preprocessor to resolve it defines in a different order or is there a better way to do this?
I really need help on this one. Cheers
X2K