<?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 - 6.10 Arithmetic Type Conversions]]></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:14 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Rule M10.1.1]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1520</link>
			<pubDate>Thu, 05 Dec 2019 22:13:10 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5073">phdenis</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1520</guid>
			<description><![CDATA[Hello,<br />
<br />
I've a problem when using the memset function, the error M10.1.1 is raised.<br />
Error raised by the MISRA Tool used (RTRT):<br />
line 12 row 30: Rule M10.1.1 <br />
Error: Implicit conversion of an integer expression to a different signedness is not allowed<br />
<br />
Regarding the memset prototype, <br />
void *memset (void *s, int c, size_t n);<br />
<br />
The content of the test.h file is given see below:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#ifndef __TEST_H__<br />
#define __TEST_H__<br />
<br />
#define CST_UZERO&nbsp;&nbsp; 0U<br />
#define CST_STRIPV4 16U /* IP: AAA.BBB.CCC.DDD */<br />
<br />
typedef signed char SINT8_T;<br />
typedef SINT8_T STRIPV4_T[CST_STRIPV4];<br />
<br />
void MyFunc(void);<br />
<br />
#endif /* __TEST_H__ */</code></div></div><br />
The content of the test.c file is given see below:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#include "test.h"<br />
#include <br />
<br />
void MyFunc(void)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;/* Local Variable(s) */<br />
&nbsp;&nbsp;&nbsp;&nbsp;STRIPV4_T NtpAddr1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;/* Init */<br />
&nbsp;&nbsp;&nbsp;&nbsp;(void) memset(&amp;NtpAddr1, CST_UZERO, CST_STRIPV4);<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;return;<br />
}</code></div></div>]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
I've a problem when using the memset function, the error M10.1.1 is raised.<br />
Error raised by the MISRA Tool used (RTRT):<br />
line 12 row 30: Rule M10.1.1 <br />
Error: Implicit conversion of an integer expression to a different signedness is not allowed<br />
<br />
Regarding the memset prototype, <br />
void *memset (void *s, int c, size_t n);<br />
<br />
The content of the test.h file is given see below:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#ifndef __TEST_H__<br />
#define __TEST_H__<br />
<br />
#define CST_UZERO&nbsp;&nbsp; 0U<br />
#define CST_STRIPV4 16U /* IP: AAA.BBB.CCC.DDD */<br />
<br />
typedef signed char SINT8_T;<br />
typedef SINT8_T STRIPV4_T[CST_STRIPV4];<br />
<br />
void MyFunc(void);<br />
<br />
#endif /* __TEST_H__ */</code></div></div><br />
The content of the test.c file is given see below:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#include "test.h"<br />
#include <br />
<br />
void MyFunc(void)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;/* Local Variable(s) */<br />
&nbsp;&nbsp;&nbsp;&nbsp;STRIPV4_T NtpAddr1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;/* Init */<br />
&nbsp;&nbsp;&nbsp;&nbsp;(void) memset(&amp;NtpAddr1, CST_UZERO, CST_STRIPV4);<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;return;<br />
}</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 10.1]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1440</link>
			<pubDate>Wed, 18 Jul 2018 09:30:20 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5073">phdenis</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1440</guid>
			<description><![CDATA[Hello all,<br />
<br />
I've an error 10.1 on the following C code:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#define MyConst 0x8A</code></div></div><br />
My Code Review checker asks to add a U to the constant. <br />
<br />
I'm quite surprised if it was a decimal value, I'll understand it but for an hexa, I don't really understand why ?<br />
<br />
Another question is to know if a test set is present on the MISRA community to check the correct behaviour of the Code Review tool.<br />
<br />
By advance thanks for your help.<br />
<br />
B/R<br />
Philippe]]></description>
			<content:encoded><![CDATA[Hello all,<br />
<br />
I've an error 10.1 on the following C code:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#define MyConst 0x8A</code></div></div><br />
My Code Review checker asks to add a U to the constant. <br />
<br />
I'm quite surprised if it was a decimal value, I'll understand it but for an hexa, I don't really understand why ?<br />
<br />
Another question is to know if a test set is present on the MISRA community to check the correct behaviour of the Code Review tool.<br />
<br />
By advance thanks for your help.<br />
<br />
B/R<br />
Philippe]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule M16.10]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1433</link>
			<pubDate>Wed, 04 Jul 2018 22:47:34 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5073">phdenis</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1433</guid>
			<description><![CDATA[Hello all,<br />
<br />
I'm using the Misra 2004:C rules for the 1st time (e.g. I'm a newbie) and I got several errors linked to the rule M16.10 when I'm using the strncpy function like that:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>strncpy(MyStr1,MyConstStr, sizeof(MyConstStr);</code></div></div><br />
I've fixed this error by adding a pointer to the code which is not used.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>char *MyPtr;<br />
MyPtr = strncpy(MyStr1,MyConstStr, sizeof(MyConstStr);</code></div></div><br />
So my question is:<br />
 For the functions like strncpy, memset and others functions of the same style, do we need to fix the misra error or do we have to justify it plainly?<br />
<br />
By advance, thanks for your help.]]></description>
			<content:encoded><![CDATA[Hello all,<br />
<br />
I'm using the Misra 2004:C rules for the 1st time (e.g. I'm a newbie) and I got several errors linked to the rule M16.10 when I'm using the strncpy function like that:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>strncpy(MyStr1,MyConstStr, sizeof(MyConstStr);</code></div></div><br />
I've fixed this error by adding a pointer to the code which is not used.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>char *MyPtr;<br />
MyPtr = strncpy(MyStr1,MyConstStr, sizeof(MyConstStr);</code></div></div><br />
So my question is:<br />
 For the functions like strncpy, memset and others functions of the same style, do we need to fix the misra error or do we have to justify it plainly?<br />
<br />
By advance, thanks for your help.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[int vs long when sizes are identical and issue with int32_t (from rule 6.3) in rule 10.1 example]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1364</link>
			<pubDate>Mon, 11 Sep 2017 18:14:58 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=4847">abgs</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1364</guid>
			<description><![CDATA[Rule 10.1 contains the following example:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>s32a = s16a + (int32_t)20000; /* compliant */</code></div></div>Rule 6.3 suggests this definition of int32_t:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>typedef signed int int32_t;</code></div></div>The addition expression is a complex expression per 6.10.5.<br />
The underlying type of s16a is int16_t.<br />
The underlying type of (int32_t)20000 is int16_t because this is an integral constant expression and the "actual type" is int per 6.10.4:<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>If the actual type of the expression is (signed) int, the underlying type is defined to be the smallest signed integer type which is capable of representing its value.</blockquote>
 <br />
The underlying type of the sum is then int16_t (not int32_t as the example seems to assume).<br />
int16_t is being assigned to int32_t which requires a conversion to change the underlying type, but this is a violation of rule 10.1 because the sum is a complex expression. Thus the example appears not to be compliant.<br />
<br />
Is this example incorrect when int32_t is int?<br />
It appears that the behavior would be different if int32_t were long because the integral constant expression rule would not apply, is this intentional? How should this potential difference in the definition be handled?<br />
If int and long are the same size, does conversion between int and long violate rule 10.1 because it only allows conversions to wider types and not to types of the same size?]]></description>
			<content:encoded><![CDATA[Rule 10.1 contains the following example:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>s32a = s16a + (int32_t)20000; /* compliant */</code></div></div>Rule 6.3 suggests this definition of int32_t:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>typedef signed int int32_t;</code></div></div>The addition expression is a complex expression per 6.10.5.<br />
The underlying type of s16a is int16_t.<br />
The underlying type of (int32_t)20000 is int16_t because this is an integral constant expression and the "actual type" is int per 6.10.4:<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>If the actual type of the expression is (signed) int, the underlying type is defined to be the smallest signed integer type which is capable of representing its value.</blockquote>
 <br />
The underlying type of the sum is then int16_t (not int32_t as the example seems to assume).<br />
int16_t is being assigned to int32_t which requires a conversion to change the underlying type, but this is a violation of rule 10.1 because the sum is a complex expression. Thus the example appears not to be compliant.<br />
<br />
Is this example incorrect when int32_t is int?<br />
It appears that the behavior would be different if int32_t were long because the integral constant expression rule would not apply, is this intentional? How should this potential difference in the definition be handled?<br />
If int and long are the same size, does conversion between int and long violate rule 10.1 because it only allows conversions to wider types and not to types of the same size?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Casting integer to floating point]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1280</link>
			<pubDate>Tue, 04 Oct 2016 12:46:54 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=4323">bobvanderputten</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1280</guid>
			<description><![CDATA[I have the following code:<br />
<br />
int16_t    int_torque_I_MUL;<br />
float32_t    f_temp1;<br />
...<br />
f_temp1 = (float32_t)(int_torque_I_MUL);<br />
...<br />
 The above will generate:<br />
MISRA-C:2012 R.10.1,R.10.3,R.10.4,R.10.5,R.11.1: Value is not of appropriate type. : (double and short)<br />
But I don't understand why??<br />
How can I cast a signed 16 bit integer to a double (float32_t )?]]></description>
			<content:encoded><![CDATA[I have the following code:<br />
<br />
int16_t    int_torque_I_MUL;<br />
float32_t    f_temp1;<br />
...<br />
f_temp1 = (float32_t)(int_torque_I_MUL);<br />
...<br />
 The above will generate:<br />
MISRA-C:2012 R.10.1,R.10.3,R.10.4,R.10.5,R.11.1: Value is not of appropriate type. : (double and short)<br />
But I don't understand why??<br />
How can I cast a signed 16 bit integer to a double (float32_t )?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[How to fix Warnings 10.1 and 10.3]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1186</link>
			<pubDate>Fri, 12 Jun 2015 18:58:51 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=3899">chas</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1186</guid>
			<description><![CDATA[Hi. We're new to MISRA-2004. Can anyone explain why I get these warnings and how to fix them. We are using Code Composer.<br />
<br />
unsigned int x = 0U;<br />
unsigned int* px;<br />
<br />
px = &amp;x; /* 10.1 warning */<br />
px = (unsigned int*)&amp;x; /* 10.3 warning */]]></description>
			<content:encoded><![CDATA[Hi. We're new to MISRA-2004. Can anyone explain why I get these warnings and how to fix them. We are using Code Composer.<br />
<br />
unsigned int x = 0U;<br />
unsigned int* px;<br />
<br />
px = &amp;x; /* 10.1 warning */<br />
px = (unsigned int*)&amp;x; /* 10.3 warning */]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Clarification on rule 10.6]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1170</link>
			<pubDate>Tue, 24 Mar 2015 10:23:21 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=3719">anuj1085</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1170</guid>
			<description><![CDATA[Is the rule only applies to "u" suffix or this rule also applies to "UL", "L" and other suffixes]]></description>
			<content:encoded><![CDATA[Is the rule only applies to "u" suffix or this rule also applies to "UL", "L" and other suffixes]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Typecasting from signed to unsigned and vis-verse]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1091</link>
			<pubDate>Thu, 31 Jul 2014 10:47:24 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=3403">deepabagalkot</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1091</guid>
			<description><![CDATA[Hi,<br />
<br />
Please can anybody help me to understand whether Misra C rules support signed to unsigned and vis-verse data typecasting?<br />
<br />
If there is requirement to do some manipulation on signed and unsigned values, then i think it is ok to type-caste. But the requirement given to us says that whenever there is typecasting happening from signed to unsigned and vis-verse, then such incident should be failed.<br />
<br />
Thanks in advance,<br />
Deepa]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
Please can anybody help me to understand whether Misra C rules support signed to unsigned and vis-verse data typecasting?<br />
<br />
If there is requirement to do some manipulation on signed and unsigned values, then i think it is ok to type-caste. But the requirement given to us says that whenever there is typecasting happening from signed to unsigned and vis-verse, then such incident should be failed.<br />
<br />
Thanks in advance,<br />
Deepa]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 10.1 violation with casting]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1025</link>
			<pubDate>Thu, 06 Feb 2014 12:29:55 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=3109">Frasew</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1025</guid>
			<description><![CDATA[Hello,<br />
<br />
my MISRA checker generates a MISRA violation 10.1 (The signedness of an integer type is converted implicitly.(signed -&gt; unsigned)), although a casting is done. <br />
<br />
My C code:<br />
<br />
1:  #include <br />
2: typedef unsigned char U8;<br />
...<br />
w: U8  WriteProtect  = (U8) true;<br />
....<br />
x: if(WriteProtect == (U8) false) {<br />
....<br />
y:     WriteProtect = (U8) true;<br />
....<br />
z: }<br />
<br />
The MISRA checker identifies line x and y as a rule 10.1 violation. Why is this a rule 10.1 violation although a casting is done? Interestingly the MISRA checker identifies line w as OK. Have anybody an idea what is my fault?<br />
<br />
Is it generally impossible in MISRA to assign a signed var to an unsigned var?]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
my MISRA checker generates a MISRA violation 10.1 (The signedness of an integer type is converted implicitly.(signed -&gt; unsigned)), although a casting is done. <br />
<br />
My C code:<br />
<br />
1:  #include <br />
2: typedef unsigned char U8;<br />
...<br />
w: U8  WriteProtect  = (U8) true;<br />
....<br />
x: if(WriteProtect == (U8) false) {<br />
....<br />
y:     WriteProtect = (U8) true;<br />
....<br />
z: }<br />
<br />
The MISRA checker identifies line x and y as a rule 10.1 violation. Why is this a rule 10.1 violation although a casting is done? Interestingly the MISRA checker identifies line w as OK. Have anybody an idea what is my fault?<br />
<br />
Is it generally impossible in MISRA to assign a signed var to an unsigned var?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Appendix B - mapping of rule 10.2]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=960</link>
			<pubDate>Tue, 23 Apr 2013 09:41:52 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=2627">andream</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=960</guid>
			<description><![CDATA[It seems there is a minor inconsistency in MISRA-C 2004. At top of pag. 103 (Appendix B) I can read that rule 77 in MISRA-C 1998 is mapped onto rule 10.2 in MISRA-C 2004. Indeed this latter is as duly reported in third column ("The value of an expression of floating type..."), but corresponding rule 77 in MISRA C 1998 is well different:<br />
<br />
"The unqualifed type of parameters passed to a function shall be compatible with the unqualified expected types defined in the function prototype". <br />
<br />
Can you help me?]]></description>
			<content:encoded><![CDATA[It seems there is a minor inconsistency in MISRA-C 2004. At top of pag. 103 (Appendix B) I can read that rule 77 in MISRA-C 1998 is mapped onto rule 10.2 in MISRA-C 2004. Indeed this latter is as duly reported in third column ("The value of an expression of floating type..."), but corresponding rule 77 in MISRA C 1998 is well different:<br />
<br />
"The unqualifed type of parameters passed to a function shall be compatible with the unqualified expected types defined in the function prototype". <br />
<br />
Can you help me?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[10.1 Non-constant value to function]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=924</link>
			<pubDate>Mon, 26 Nov 2012 11:58:28 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=2267">borth</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=924</guid>
			<description><![CDATA[Hey,<br />
<br />
i have a problem with these 10.1 Rule:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>void foo_bar(uint32_t u32)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* another function to do something */<br />
<br />
void test_func(uint8_t u8)<br />
{<br />
&nbsp;&nbsp; uint32_t u32Convert = (uint32_t)u8;<br />
&nbsp;&nbsp; ...<br />
&nbsp;&nbsp; foo_bar(u32Convert);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*Error - Note 960 Violates MISRA 2004 Required Rule 10.1, Prohibited Implicit Conversion: Non-constant argument to function */<br />
&nbsp;&nbsp; ...<br />
}</code></div></div>MISRA says that a expression, which is a function argument, shouldn't be converted to a underlying type.<br />
But i took a 8 bit value, expand to 32bit and use this for the function. The type of u32Convert is uint32_t as it should be for the function argument of foo_bar.<br />
Is it neccessary to know what foo_bar does with the value?<br />
<br />
Thanks for your help!<br />
Greetz,]]></description>
			<content:encoded><![CDATA[Hey,<br />
<br />
i have a problem with these 10.1 Rule:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>void foo_bar(uint32_t u32)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* another function to do something */<br />
<br />
void test_func(uint8_t u8)<br />
{<br />
&nbsp;&nbsp; uint32_t u32Convert = (uint32_t)u8;<br />
&nbsp;&nbsp; ...<br />
&nbsp;&nbsp; foo_bar(u32Convert);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*Error - Note 960 Violates MISRA 2004 Required Rule 10.1, Prohibited Implicit Conversion: Non-constant argument to function */<br />
&nbsp;&nbsp; ...<br />
}</code></div></div>MISRA says that a expression, which is a function argument, shouldn't be converted to a underlying type.<br />
But i took a 8 bit value, expand to 32bit and use this for the function. The type of u32Convert is uint32_t as it should be for the function argument of foo_bar.<br />
Is it neccessary to know what foo_bar does with the value?<br />
<br />
Thanks for your help!<br />
Greetz,]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[10.1 in a macro]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=917</link>
			<pubDate>Tue, 02 Oct 2012 06:34:59 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=2267">borth</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=917</guid>
			<description><![CDATA[Hello,<br />
<br />
<br />
i got something like this:<br />
<br />
[code]<br />
#define X_MASK 0xFU<br />
#define FOO(_a) ((_a) % 10U)<br />
#define BAR(_b) (1U ]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
<br />
i got something like this:<br />
<br />
[code]<br />
#define X_MASK 0xFU<br />
#define FOO(_a) ((_a) % 10U)<br />
#define BAR(_b) (1U ]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[if statement with structure member and rule 10.1]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=863</link>
			<pubDate>Fri, 11 Nov 2011 11:10:36 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=1823">rhbarnes</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=863</guid>
			<description><![CDATA[I have a structure containing an unsigned int member; if I use any of the relational operators (&gt;=, = u16_rev1_min)       /* this violates rule 10.1 */<br />
{<br />
  // do something...<br />
}<br />
<br />
uint16_t u16_rev1_min, u16_tmp;<br />
u16_tmp = st_hardware_revs.u16_hw_rev1;<br />
if (u16_tmp &gt;= u16_rev1_min)       /* this does not violates rule 10.1 */<br />
{<br />
  // do something...<br />
}<br />
[/code]<br />
<br />
My initial thought was due to the underlying 'int' type of the relational operator, however if this is the case then why does the second piece of code pass? Am I missing some implicit conversion applied to the strucuture reference?<br />
<br />
Regards]]></description>
			<content:encoded><![CDATA[I have a structure containing an unsigned int member; if I use any of the relational operators (&gt;=, = u16_rev1_min)       /* this violates rule 10.1 */<br />
{<br />
  // do something...<br />
}<br />
<br />
uint16_t u16_rev1_min, u16_tmp;<br />
u16_tmp = st_hardware_revs.u16_hw_rev1;<br />
if (u16_tmp &gt;= u16_rev1_min)       /* this does not violates rule 10.1 */<br />
{<br />
  // do something...<br />
}<br />
[/code]<br />
<br />
My initial thought was due to the underlying 'int' type of the relational operator, however if this is the case then why does the second piece of code pass? Am I missing some implicit conversion applied to the strucuture reference?<br />
<br />
Regards]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[if-statement with two checks with different data types]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=830</link>
			<pubDate>Tue, 07 Jun 2011 08:02:17 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=1612">MaWu</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=830</guid>
			<description><![CDATA[Hi everyone!<br />
<br />
I have a question about rule 10.1 and 10.2<br />
Whenever I try to work with an if or while and use two comparions which are logically connected I get an MISRA issue when the two comparisons have different data types.<br />
e.g. int16 and int32<br />
Because the results of the two comparions is somehow boolean I would not expected to get:<br />
The value of an expression implicitly converted to a different type.<br />
<br />
Is it really an issue? I know I can cast both to the same data type but it looks strange.<br />
<br />
Example:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>t_int8 a = 3;<br />
t_uint16 b = 7;<br />
&nbsp;&nbsp; <br />
if ((a &gt; 3) &amp;&amp; (b &gt; 5u))<br />
{<br />
&nbsp;&nbsp; a++;&nbsp;&nbsp;<br />
}</code></div></div>]]></description>
			<content:encoded><![CDATA[Hi everyone!<br />
<br />
I have a question about rule 10.1 and 10.2<br />
Whenever I try to work with an if or while and use two comparions which are logically connected I get an MISRA issue when the two comparisons have different data types.<br />
e.g. int16 and int32<br />
Because the results of the two comparions is somehow boolean I would not expected to get:<br />
The value of an expression implicitly converted to a different type.<br />
<br />
Is it really an issue? I know I can cast both to the same data type but it looks strange.<br />
<br />
Example:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>t_int8 a = 3;<br />
t_uint16 b = 7;<br />
&nbsp;&nbsp; <br />
if ((a &gt; 3) &amp;&amp; (b &gt; 5u))<br />
{<br />
&nbsp;&nbsp; a++;&nbsp;&nbsp;<br />
}</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Underlying type for integer constant expressions]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=822</link>
			<pubDate>Tue, 12 Apr 2011 09:30:42 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=109">Mats Fors</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=822</guid>
			<description><![CDATA[The initialization:<br />
  uint8_t d = ((uint8_t) 0x1U) | ((uint8_t) 0x2U);<br />
should, according to the MISRA-C guidelines, generate an error for rule 10.1. The initializer, i.e. the integer constant expression, has the underlying type of uint8_t, but that type is overruled by the explicit rule for integer constant expressions in 6.10.4 that says that the signedness/unsignedness of the underlying type should be taken from the actual type of the integer constant expression, but only if it is signed or unsigned int. In this case it is signed int. Giving the rule 10.1 breakage. Is this really the intention of the MISRA-C guidelines for integer constant expressions?]]></description>
			<content:encoded><![CDATA[The initialization:<br />
  uint8_t d = ((uint8_t) 0x1U) | ((uint8_t) 0x2U);<br />
should, according to the MISRA-C guidelines, generate an error for rule 10.1. The initializer, i.e. the integer constant expression, has the underlying type of uint8_t, but that type is overruled by the explicit rule for integer constant expressions in 6.10.4 that says that the signedness/unsignedness of the underlying type should be taken from the actual type of the integer constant expression, but only if it is signed or unsigned int. In this case it is signed int. Giving the rule 10.1 breakage. Is this really the intention of the MISRA-C guidelines for integer constant expressions?]]></content:encoded>
		</item>
	</channel>
</rss>