C???????
????????? ???????[ 2010/5/26 17:00:11 ] ????????
enum {
????OlderSmall = 0??
????NewerLarge = 1
};
#define Older Newer
#define Small Large
#define _replace_1(Older?? Small) Older##Small
#define _replace_2(Older?? Small) _replace_1(Older?? Small)
void printout( void )
{
????// _replace_1( Older?? Small ) becomes OlderSmall (not NewerLarge)??
????// despite the #define calls above.
????printf("Check 1: %d
"?? _replace_1( Older?? Small ) );
????// The parameters to _replace_2 are substituted before the call
????// to _replace_1?? so we get NewerLarge.
????printf("Check 2: %d
"?? _replace_2( Older?? Small ) );
}
results is:
Check 1: 0
Check 2: 1
????----------------------------------------------------------
#define FOO bar
#define QUOTEME_(x) #x
#define QUOTEME(x) QUOTEME_(x)
the code
printf("FOO=%s
"?? QUOTEME(FOO));
?????==>
printf("FOO=%s
"?? "bar");
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11