A question for Rule8.3

Moderators: misra-c, david ward

Post Reply
nyoshi
Posts: 1
Joined: Mon Jun 02, 2014 2:00 pm
Company: SESSAME

A question for Rule8.3

Post by nyoshi » Thu Oct 02, 2014 6:31 pm

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: Select all

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

struct  tab a;
[test2.c]

Code: Select all

struct tab {
   signed char a;
   signed short int  b;
};

extern struct tab a; /* non-compliant - incompatible version */
Best Regards,
nyoshi

misra-c
Posts: 571
Joined: Thu Jan 05, 2006 1:11 pm

Re: A question for Rule8.3

Post by misra-c » Fri Nov 07, 2014 9:12 am

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

Post Reply

Return to “8.8 Declarations and defnitions”