0
我上运行代码的PC - 皮棉8.00x类似以下内容:如何抑制关于匿名结构的Lint消息?
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 - 皮棉返回以下错误信息:
Error 40: Undeclared identifier 'blue'
Error 63: Expected an lvalue
代码编译并按预期运行。 我假设这是因为匿名结构,这个假设是否正确?如果是这样,我怎样才能抑制这些特定情况下的消息?我当前压制“options.lnt”文件中的消息,因为我们的本地编码实践禁止直接在代码中放置注释来抑制Lint消息。