MISRA Discussion Forums

Full Version: Rule 17.4
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I am finding a violation (with IBM logiscope) when i use an array within a structure.

so my structure is:
Code:
typedef struct
{
unsigned char a;
unsigned char b;
unsigned char c[10];
unsigned char d;
}mID;
and my main:

mID tester;
Code:
int main(void)
{
tester.a = 0x01;
tester.c[2] = 0x02;
tester.c[3] = 0x06;
tester.c[4] = 0x05;
return 0;
}

for each assignment to .c i am told "pointer arithmetic only with array indexing"

thanks for any advice

matt
It would seem that your static analyzer is flawed. The only problem with that code is that you are declaring mID global, which violates rule 8.7.
This code does not violate Rule 17.4.