标签归档:keil

MDK 出现#68-D: integer conversion resulted in a change of sign(转)

在KeilARM的LPCARM,存在(1<<31)编译警告问题main.c(174): warning: #61-D: integer operation result is out of rangemain.c(174): warning: #68-D: integer conversion resulted in a change of sign由于编译器默认signed int即32位有符号整数类型,而1<<31实际为0x80000000,这样就有可能改写了符号位(最高位)依此类推,(2<<30),(3<<29)…等都会出现编译警告问题.解决办法为: ((unsigned int)1<<31),((unsigned int)2<<30),…