struct DummyStruct{
unsigned long long std;
int type;
};
DummyStruct d;
d.std = 100;
d.type = 10;
/// buggy printf, unsigned long long to int conversion is buggy.
printf("%d,%d\n",d.std, d.type); // OUTPUT: 0,100
printf("%d,%d\n", d.type, d.std); // OUTPUT: 10,100
printf("%lld,%d\n",d.std, d.type); // OUTPUT: 100,10
Run Code Online (Sandbox Code Playgroud)
请告诉我为什么在printf中没有正确处理unsigned long long to int转换.我正在使用glibc.
这是printf中的错误吗?
为什么printf不进行内部类型转换?