but i can't figure how to do the macro so that it expands _PCN before passing it to the next one, it ends up as Initx_PCN(a) instead of Initx3(a). I've read the gnu gcc page but cant find something about this. There's about macro inside macro but not about define inside macro...
I do not think a single preprocessor pass will accomplish this. Try a multi pass by just issuing a preprocess command before you do your normal compile and link. You can do this on gcc with "gcc -E mycode.c" . Then do a normal build.
@cppbuser
it wasn't neccessary to do multipass, but that command sure helped me. I used it to see the actual output from the preprocesor rather than just the blablabalerrorhere
also found a little help here in case someone is also interested
http://stackoverflow.com/questions/1597007/creating-c-macro-with-and-line-token-concatenation-with-positioning-macr
the solution was to add some extra levels to the macro to give it a chance to expand
also if you do want to multi pass, (things that will horrify your CS professor) you can do something like this. It fails on 1 pass, compile, and link, but with 2 pass, compile, and link it works fine. This opens up a lot of interesting possibilities if you start using conditionals. Perhaps you can do a lot of cpp stuff with ordinary c ...
#define FIRST #define SECOND 9999
#define BLUE 52
#define REDGREEN BLUE
#define RED 51
#define COLOR(a,b) a##b