我想知道,如果这样:
#define size 8
#if ( 0 < size ) and ( size <= 16 )
static unsigned char value;
#elif ( 8 < size ) and ( size <= 16 )
static unsigned short value;
#elif ( 16 < size ) and ( size <= 32 )
static unsigned value;
#elif ( 32 < size ) and ( size <= 64 )
static unsigned long value;
#else
return 0;
#endif
#undef size
可以用常数吗?我试过了:
const unsigned char size = 8;
if ( ( 0 < size ) && ( size <= 8 ) ) {
static unsigned char value;
} else if ( ( 8 < size ) && ( size <= 16 ) ) {
static unsigned short value;
} else if ( ( 16 < size ) && ( size <= 32 ) ) {
static unsigned value;
} else if ( ( 32 < size ) && ( size <= 64 ) ) {
static unsigned long value;
} else {
return 0;
}
但结果我得到了:
致命错误:使用未声明的标识符“值”
这可能吗?