Page 1 of 1

Rule 17.4

Posted: Wed Mar 31, 2010 8:25 am
by mshearer123
I am finding a violation (with IBM logiscope) when i use an array within a structure.

so my structure is:

Code: Select all

typedef struct
unsigned char a;
unsigned char b;
unsigned char c[10];
unsigned char d;
and my main:

mID tester;

Code: Select all

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


Re: Rule 17.4

Posted: Wed Apr 07, 2010 9:49 am
by Lundin
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.

Re: Rule 17.4

Posted: Thu May 13, 2010 10:51 am
by misra-c
This code does not violate Rule 17.4.