测试以下代码:
#include <stdio.h>
#include <stdlib.h>
main()
{
const char *yytext="0";
const float f=(float)atof(yytext);
size_t t = *((size_t*)&f);
printf("t should be 0 but is %d\n", t);
}
编译它:
gcc -O3 test.c
好的输出应该是:
"t should be 0 but is 0"
但是使用我的 gcc 4.1.3,我有:
"t should be 0 but is -1209357172"