C99 struct initialization
Error is generated with the foolowing code, which is valide C99:
typedef union
{
struct
{
unsigned int a : 4;
unsigned int b : 4;
unsigned int c : 4;
unsigned int d : 4;
} bits;
unsigned short value;
} My_Value;
int main(void)
{
My_Value test[] =
{
{
.bits.a = 2,
.bits.b = 3,
.bits.c = 2,
.bits.d = 3,
},
{
.bits.a = 1,
.bits.b = 1,
.bits.c = 1,
.bits.d = 0,
},
};
return 0;
}
![](https://secure.gravatar.com/avatar/4a7124fd185039ca5a62be95433a7b27?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
This issue is corrected in the upcoming PC-lint Plus. If you are encountering an issue with C99 struct initialization in PC-lint or FlexeLint, please contact support for assistance.
-
Anonymous commented
This is a very common pattern used in processor header files, which makes linting on embedded systems complicated.