c - Can you capitalize a pasted token in a macro? -
In C macros, is it possible to capitalize a paste-in token? For example, I currently have the following macros:
#define test (name, keyword) \ test_ ## name: test _ ## keyword ## _keyword
I will do this as follows:
exam (test1, test1)
which will be as follows:
test_test1: TEST_TEST1_KEYWORD
Now, instead of typing the same name twice (with all lower case letters once and then with all upper case letters), there is no way That I do any of the following Is power, and either change the token in all uppercase letters or all lowercase letters?
test (test1) or test (test1)
thanks, Ryan
As far as I know, it can be done on tokens only to make 'Sterefove' or copy in the only operation C preprocessor (at least ISO / ANSI standard). I am also unaware of any GCC or MSVC extension that will let you do what you want to do.
However, people are coming up with magical (or awful) things in clever (or strange) macros, so I will not be surprised if I wonder.
Comments
Post a Comment