C语言中的undefined behavior系列(5) -- not compatible type
时间:2010-08-31 来源:嗷嗷
— Two declarationsof the same object or function specify types that are not compatible(6.2.7).
char c = 'a';
char *pc = &c;
int *pi;
void *pv;
pi = pv = pc; //这里没有编译错误或警告
//pv = pi =pc; //这样写的话会有一个warning a value of type "char *" cannot be assigned to an entity of type "int *"
*pi = 10; //undefined behavior
相关阅读 更多 +