This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
工具/软件:TI C/C++编译器
大家好,我创建了这个简单的C文件来演示我的问题:
#include <stdint.h> typedef enum { enum_value_0, enum_value_1, } MyEnum_t,} MyEnum_t; extern volatile Int32_t myInteger; int main(void) { MyEnum_t EnumerValue =(MyEnum_t)myValue; if ((Eenum Value>===_num_Value_0)<) and num_numValue 返回0;}
这将提供编译器输出:
****配置构建调试项目编号测试****
"C:\\ti\\ccsv7\\utils\\bin\\gmake "-k -j 7 all -o
'建筑文件:../main.c'
'调用:C6000编译器'
"C:/ti/ccsv7/tools/compiler/ti-CGT-C6000_Verbos.1/bin/cl65" 8.2 -mv6600 --include_path="C:8.2 .1/include"-g --c99 --verbose_diagnostics --pre_with _main_compility-c"。
"../main.c",第16行:警告:无符号整数与 零的无意义比较
如果((EnumerValue >= ENUM_Value_0)&&(EnumerValue <= ENUM_Value_2))
^
我不明白为什么会为我的枚举生成此警告,因为根据SPRUI04B中的第7.4 .1节“枚举类型的大小”:
"对于C++和RELEND C89/C99,编译器允许枚举常量达到最大的积分类型
(64位)。 建议使用默认值,将基础类型设置为以下第一种类型
可以表示所有枚举常量值的列表:int,unsigned int,long long,unsigned
很长。"
我将该引用解释为表示枚举的基础类型应该是int,因为所有枚举常量值(在本例中为0,1和2)都可以用int表示。 但警告似乎表明底层类型是无符号的。
请让我知道我对此有什么误解。 提前感谢您的帮助!
此致,
戴夫
考古学家,您好,您是否知道我何时可能会收到有关此问题的反馈?
我对拖延表示歉意。
您可以使用我签名中下面的SDOWP链接来跟踪此错误。
编译器产品版显示 ,C6000 8.2 .x编译器的下一个版本目前计划于10月31日发布。 我不知道该版本中是否会解决此问题。 因为距离现在还不到一个月,我怀疑不是。
谢谢,此致,
-George