MISRA Discussion Forums

Full Version: A question for Rule8.3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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.