You only have one instance of NAME in each macro. You also have an example of _NAME in each macro, but that's highly questionable: names beginning with an underscore and having a capital letter following are reserved for the implementation, and so you could have a problem there.
However, you want to take the value of NAME and concatenate something to it, let's say putting a E_
in front. This is a little tricky, since _##NAME
will normally get you _NAME
, no matter what you put in.
This is explained on the C++ FAQ Lite, but what you really have to do is something like:
#define REALLY_CONCATENATE(a,b) a ## b
#define CONCATENATE(a,b) REALLY_CONCATENATE(a,b)
#define SCOPED_ENUM_HEADER(NAME) struct NAME{ enum CONCATENATE("E_", NAME) {
(sorry, can't test this right now).
On the other hand, there has got to be a better way to do what you're doing. Seriously.