一个老板也解释不了的问题?
yd614 2001-06-12 08:51:00 #include <stdio.h>
enum debugModel
{
allDetectPoint = 0,
acceptPoint = 1,
noDebug = 2
};
static int g_model = allDetectPoint;
void main(void)
{
printf("\n");
#if (g_model == allDetectPoint)
printf("0 ");
#else
printf("1 ");
#endif
#if (g_model == acceptPoint)
printf("1 ");
#else
printf("0 ");
#endif
printf("over\n");
}
输出结果为
0 1 over
即:条件恒为真,如果不用枚举元素、直接用数字就正常了。
问了老板,他也解释不了,那位高手来解释一下,解释合理都送分。