您的位置:首页 > 产品设计 > UI/UE

GCC(ARM) warning: comparison is always true due to limited range of data type

2013-12-19 11:28 1216 查看
char ch;

while((ch = getopt(argc,argv,"d:h"))!=EOF
switch(ch{
case 'h'
...

GCC X86    OK!
GCC Arm 警告如下

warning: comparison is always true due to limited range of data type
改为int ch即可

The C and C++ standards allows the character type char to be signed or unsigned, depending on the platform and compiler. Most systems, including x86 GNU/Linux and Microsoft Windows, use signed char, but those based on PowerPC and ARM processors typically
use unsigned char.(29) This can lead to unexpected results when porting programs between platforms which have different defaults for the type of char.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐