问题
I want to declare a define, using Visual Studio 2008 or 2010, like that:
#define a.b c.d
and I get following error:
error C2008: '.' : unexpected in macro definition
I see that I am allowed to create a define like this:
#define a c.d
Is the a.b
notation supposed to be allowed in the macro name?
回答1:
Macros has same set of rules for naming, as do identifiers. In fact, macro-names are identifiers.
So,
- They cannot contain dot.
- They can consist of only alphabet, digits, and underscore. Nothing else. They cannot start with a digit, however.
回答2:
How about doing the follwing instead?
#define a c
#define b d
来源:https://stackoverflow.com/questions/8040391/can-you-use-a-b-notation-in-a-define-macro-name