Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A question for Rule8.3
#1
I have a question for an exception of Rule8.3.

I think that the structure "tab" of the following sample does not have compatibility.
Is this right?

Code:
[test1.c]
struct tab {
   signed char a;
   signed short  b;
};

struct  tab a;

[test2.c]
Code:
struct tab {
   signed char a;
   signed short int  b;
};

extern struct tab a; /* non-compliant - incompatible version */

Best Regards,
nyoshi
<t></t>
#2
The exception to rule 8.3 allows compatible versions of the same basic type to be used interchangeably. This include basic types used within a structure declaration.

"signed short" and "signed short int" are compatible versions of the same basic type, which means the two versions of the "struct tab" are compatible.
Posted by and on behalf of the MISRA C Working Group


Forum Jump:


Users browsing this thread: 1 Guest(s)