【发布时间】:2013-11-25 18:41:55
【问题描述】:
我在类似于以下的代码上运行 PC-Lint 8.00x:
typedef union
{
struct
{
unsigned int blue : 5;
unsigned int green : 6;
unsigned int red : 5;
};
unsigned short color_value;
} Color_Type;
Color_Type my_color;
unsigned char blue;
blue = (unsigned char)my_color.blue; /* Lint messages occur here */
PC-Lint 返回以下错误消息:
Error 40: Undeclared identifier 'blue'
Error 63: Expected an lvalue
代码按预期编译和运行。 我假设这是因为匿名结构,这个假设是否正确?如果是这样,在这种特殊情况下,我如何抑制这些消息?我目前抑制“options.lnt”文件中的消息,因为我们的本地编码实践禁止将 cmets 直接放在代码中以抑制 Lint 消息。
【问题讨论】: