Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Misra rule 45

i compiled the following code using a misra checking compiler

unsigned char data[1];

after compilation it was showing two errors violating rule 45 and rule 77

i changed the line as given below.

it removed the error violating 77.

But i couldnot find any way to comply with rule 45

Can any one have any idea to perform the above actions without
violating the rule
Answer: MISRA C Steering Team 5/1/06

unsigned char data[1];

The example above is not in violation of either Rule 45 or 77.

void * is compatible with any other pointer, and therefore no cast is required.

See in ISO C 9899:1990.

Rule 45 can only be violated by a cast.
<t>Gavin McCall<br/>
Personal view only.</t>

Iam using IAR embedded workbench compiler
it is a fact any value can be assigned to void*.

But the compiler is showing the violation of rule 45 and rule 77
for the below code

Are you sure that you have to be MISRA C, 1998 compatible? MISRA C, 2002 seem to be so stringent. Thats why Gavin said that whatever you have done is alright.
<t>Raveendran Vadakkoot</t>

I check out the version from the IAR Misra C reference guide.
It is based on MISRA C 1998.
You can make the system MISRA C,2002 compliant. As I mentioned earlier, MISRA C, 2002 is NOT very stringent. For things which are not MISRA C compliant, you can release note it mentioning the limitation.
<t>Raveendran Vadakkoot</t>

Forum Jump:

Users browsing this thread: 1 Guest(s)