<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[MISRA Discussion Forums - 8.6 Types]]></title>
		<link>https://forum.misra.org.uk/</link>
		<description><![CDATA[MISRA Discussion Forums - https://forum.misra.org.uk]]></description>
		<pubDate>Thu, 05 Nov 2026 15:13:24 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Rule 6.1 Declaration of bitfields with the C90 compiler that accepts the ANSI C diale]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1672</link>
			<pubDate>Fri, 23 Feb 2024 02:01:47 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=6317">tomoko.mabuchi</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1672</guid>
			<description><![CDATA[Hi.<br />
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?<br />
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.<br />
With this setting, I think the declaration of bitfields below is a permitted deviation. Is my understanding correct?<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>typedef struct<br />
{<br />
    unsigned char bit0 :1;<br />
    unsigned char bit1 :1;<br />
    unsigned char bit2 :1;<br />
    unsigned char dummy :5;<br />
} st_sample;</code></div></div>]]></description>
			<content:encoded><![CDATA[Hi.<br />
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?<br />
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.<br />
With this setting, I think the declaration of bitfields below is a permitted deviation. Is my understanding correct?<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>typedef struct<br />
{<br />
    unsigned char bit0 :1;<br />
    unsigned char bit1 :1;<br />
    unsigned char bit2 :1;<br />
    unsigned char dummy :5;<br />
} st_sample;</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 6.1]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1016</link>
			<pubDate>Wed, 15 Jan 2014 06:48:45 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=2833">Akhil</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1016</guid>
			<description><![CDATA[In the Amplification for Rule 6.1 : <br />
<br />
For C99 : The appropriate types are :<br />
<br />
1. either unsigned or signed int.<br />
    This refers to unsigned int and signed int only OR any other datatype..?<br />
<br />
2. Another explicitly signed or explicitly unsigned integer type that is premitted by the implementation.<br />
    What all types does this refer to ? Does this refer to unsigned short OR unsigned short int etc.<br />
<br />
Please clarify.]]></description>
			<content:encoded><![CDATA[In the Amplification for Rule 6.1 : <br />
<br />
For C99 : The appropriate types are :<br />
<br />
1. either unsigned or signed int.<br />
    This refers to unsigned int and signed int only OR any other datatype..?<br />
<br />
2. Another explicitly signed or explicitly unsigned integer type that is premitted by the implementation.<br />
    What all types does this refer to ? Does this refer to unsigned short OR unsigned short int etc.<br />
<br />
Please clarify.]]></content:encoded>
		</item>
	</channel>
</rss>