Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 17.4
#1
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
<t></t>
Reply
#2
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.
<t></t>
Reply
#3
This code does not violate Rule 17.4.
Posted by and on behalf of the MISRA C Working Group
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)