Rule 6.1 Declaration of bitfields with the C90 compiler that accepts the ANSI C diale - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 8.6 Types (https://forum.misra.org.uk/forumdisplay.php?fid=161) +---- Thread: Rule 6.1 Declaration of bitfields with the C90 compiler that accepts the ANSI C diale (/showthread.php?tid=1672) |
Rule 6.1 Declaration of bitfields with the C90 compiler that accepts the ANSI C diale - tomoko.mabuchi - 23-02-2024 Hi. Is it possible in C90, without violating MISRA Rule 6.1, to declare bitfields defined as an explicitly signed or explicitly unsigned integer type other than the unsigned int and signed int types allowed by the compiler? According to section 8.6, this is allowed in C99. However, the compiler I use has a setting to accept the ANSI C dialect conforming to X3.159-1989. With this setting enabled, bitfields can have base types that are enumerated or integral types besides int and unsigned int. This matches A.6.5.8 in the ANSI Common Extensions appendix. With this setting, I think the declaration of bitfields below is a permitted deviation. Is my understanding correct? Code: typedef struct RE: Rule 6.1 Declaration of bitfields with the C90 compiler that accepts the ANSI C diale - misra-c - 08-08-2024 If this is well defined by your compiler, then this is an acceptable justification for your deviation |