<?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.6 Statements (C++)]]></title>
		<link>https://forum.misra.org.uk/</link>
		<description><![CDATA[MISRA Discussion Forums - https://forum.misra.org.uk]]></description>
		<pubDate>Thu, 05 Nov 2026 13:03:30 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Rule 6-2-2 Usage of std::fpclassify]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1786</link>
			<pubDate>Mon, 21 Sep 2026 08:37:41 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5614">cgpzs</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1786</guid>
			<description><![CDATA[Hi,<br />
<br />
We have seen a creative way to work around MISRA Rule 6-2-2:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>float x = ...;<br />
float y = ...;<br />
<br />
if (x == 0.F)&nbsp;&nbsp;// non-compliant<br />
if (x == y)&nbsp;&nbsp;&nbsp;&nbsp;// non-compliant<br />
<br />
if (std::fpclassify(x)&nbsp;&nbsp;&nbsp;&nbsp; == FP_ZERO)&nbsp;&nbsp;// compliant?<br />
if (std::fpclassify(x - y) == FP_ZERO)&nbsp;&nbsp;// compliant?</code></div></div><br />
Would the last 2 examples be compliant with the rule?<br />
<br />
We argue that this is an <span style="font-weight: bold;" class="mycode_b">indirect</span> test for equality and thus non-compliant.]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
We have seen a creative way to work around MISRA Rule 6-2-2:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>float x = ...;<br />
float y = ...;<br />
<br />
if (x == 0.F)&nbsp;&nbsp;// non-compliant<br />
if (x == y)&nbsp;&nbsp;&nbsp;&nbsp;// non-compliant<br />
<br />
if (std::fpclassify(x)&nbsp;&nbsp;&nbsp;&nbsp; == FP_ZERO)&nbsp;&nbsp;// compliant?<br />
if (std::fpclassify(x - y) == FP_ZERO)&nbsp;&nbsp;// compliant?</code></div></div><br />
Would the last 2 examples be compliant with the rule?<br />
<br />
We argue that this is an <span style="font-weight: bold;" class="mycode_b">indirect</span> test for equality and thus non-compliant.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[MISRA C++ 2008 Rule 6-1-1 Clarification]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1739</link>
			<pubDate>Tue, 27 May 2025 20:10:11 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=6377">mshawa</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1739</guid>
			<description><![CDATA[Given the headline text of MISRA C++ 2008 Rule 6-1-1, MISRA C++ 2023 Rule 9.6.2 seems to be the equivalent rule in this case. MISRA C++ 2023 Rule 9.6.2 includes the following non-compliant example: <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>switch(i)<br />
{<br />
    case 0:<br />
      if(x &lt; y)<br />
        goto L3;            // Non-compliant<br />
   &nbsp;&nbsp; break;<br />
<br />
    case 1:<br />
    L3:<br />
      break;<br />
}</code></div></div><br />
This example seems to echo an amplification made in the MISRA C 2012 Rule 15.3 (that has the same headline text as MISRA C++ 2008 Rule 6-1-1), which states: <ul class="mycode_list"><li><blockquote class="mycode_quote"><cite>Quote:</cite><span style="font-style: italic;" class="mycode_i"><span style="font-size: small;" class="mycode_size">For the purposes of this rule, a switch-clause that does not consist of a compound statement is treated as if it were a block.</span></span></blockquote>
<br />
</li>
</ul>
<br />
It would be greatly appreciated if you could clarify whether the above example was also intended to <span style="font-weight: bold;" class="mycode_b">violate</span> MISRA C++ Rule 6-1-1.]]></description>
			<content:encoded><![CDATA[Given the headline text of MISRA C++ 2008 Rule 6-1-1, MISRA C++ 2023 Rule 9.6.2 seems to be the equivalent rule in this case. MISRA C++ 2023 Rule 9.6.2 includes the following non-compliant example: <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>switch(i)<br />
{<br />
    case 0:<br />
      if(x &lt; y)<br />
        goto L3;            // Non-compliant<br />
   &nbsp;&nbsp; break;<br />
<br />
    case 1:<br />
    L3:<br />
      break;<br />
}</code></div></div><br />
This example seems to echo an amplification made in the MISRA C 2012 Rule 15.3 (that has the same headline text as MISRA C++ 2008 Rule 6-1-1), which states: <ul class="mycode_list"><li><blockquote class="mycode_quote"><cite>Quote:</cite><span style="font-style: italic;" class="mycode_i"><span style="font-size: small;" class="mycode_size">For the purposes of this rule, a switch-clause that does not consist of a compound statement is treated as if it were a block.</span></span></blockquote>
<br />
</li>
</ul>
<br />
It would be greatly appreciated if you could clarify whether the above example was also intended to <span style="font-weight: bold;" class="mycode_b">violate</span> MISRA C++ Rule 6-1-1.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[C++17 [[fallthrough]]; attribute and (Rule 6-4-3 and Rule 6-4-5)]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1682</link>
			<pubDate>Mon, 22 Apr 2024 18:29:43 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=6377">mshawa</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1682</guid>
			<description><![CDATA[Given the response from:  <a href="https://forum.misra.org.uk/showthread.php?tid=1679&amp;pid=3715#pid3715" target="_blank" rel="noopener" class="mycode_url">Rule 6-2-3 and C++17 [[fallthrough]]; attribute (misra.org.uk)</a> <br />
Should Rule 6-4-3(A switch statement shall be a well-formed switch statement) and Rule 6-4-5(An unconditional throw or break statement shall terminate every non-empty switch-clause) also have an exception for the [[fallthrough]]; attribute when used in an empty switch case?]]></description>
			<content:encoded><![CDATA[Given the response from:  <a href="https://forum.misra.org.uk/showthread.php?tid=1679&amp;pid=3715#pid3715" target="_blank" rel="noopener" class="mycode_url">Rule 6-2-3 and C++17 [[fallthrough]]; attribute (misra.org.uk)</a> <br />
Should Rule 6-4-3(A switch statement shall be a well-formed switch statement) and Rule 6-4-5(An unconditional throw or break statement shall terminate every non-empty switch-clause) also have an exception for the [[fallthrough]]; attribute when used in an empty switch case?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 6-2-3 and C++17 [[fallthrough]]; attribute]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1679</link>
			<pubDate>Wed, 27 Mar 2024 14:44:15 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5951">kafka</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1679</guid>
			<description><![CDATA[Should the C++17 [[fallthrough]]; attribute be given an exception for MISRA C++ 2008 Rule 6-2-3 (a null statement shall appear on a line by itself)?]]></description>
			<content:encoded><![CDATA[Should the C++17 [[fallthrough]]; attribute be given an exception for MISRA C++ 2008 Rule 6-2-3 (a null statement shall appear on a line by itself)?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 6-3-1: Does it also apply to "case" blocks?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1656</link>
			<pubDate>Thu, 24 Aug 2023 12:05:46 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5614">cgpzs</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1656</guid>
			<description><![CDATA[Consider this piece of code:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>enum Foo<br />
{<br />
&nbsp;&nbsp;a,<br />
&nbsp;&nbsp;b<br />
};<br />
<br />
<br />
void foo(Foo f)<br />
{<br />
&nbsp;&nbsp;switch(f)<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;case a:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::cout &lt;&lt; "a&#92;n";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;case b:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::cout &lt;&lt; "b&#92;n";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;}<br />
<br />
}</code></div></div><br />
Is the above compliant with M6-3-1, or does one need to add braces also to the "case" blocks, e.g.:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>case a:<br />
{<br />
  std::cout &lt;&lt; "a&#92;n";<br />
  break;<br />
}</code></div></div><br />
Thanks!]]></description>
			<content:encoded><![CDATA[Consider this piece of code:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>enum Foo<br />
{<br />
&nbsp;&nbsp;a,<br />
&nbsp;&nbsp;b<br />
};<br />
<br />
<br />
void foo(Foo f)<br />
{<br />
&nbsp;&nbsp;switch(f)<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;case a:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::cout &lt;&lt; "a&#92;n";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;case b:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::cout &lt;&lt; "b&#92;n";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;}<br />
<br />
}</code></div></div><br />
Is the above compliant with M6-3-1, or does one need to add braces also to the "case" blocks, e.g.:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>case a:<br />
{<br />
  std::cout &lt;&lt; "a&#92;n";<br />
  break;<br />
}</code></div></div><br />
Thanks!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 6-5-2: Non-Compliant Example Clarification]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1642</link>
			<pubDate>Thu, 09 Feb 2023 17:36:03 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=6067">vapdrs</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1642</guid>
			<description><![CDATA[I am looking for some clarification on the first non-compliant example for Rule 6-5-2, and the overall definition of a <span style="font-style: italic;" class="mycode_i">loop-counter</span>, which as part of its definition states it must be,<br />
<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>an operand to a relational operator in condition</blockquote>
<br />
<br />
Where relational operator is defined in Rule 4-5-2, 4-5-3, and §5.9 as &lt;, &gt;, &lt;=, and &gt;=.<br />
<br />
In the non-compliant example<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>for ( i = 1; i != 10; i += 2 ) // Non-compliant</code></div></div><br />
The variable <span style="font-weight: bold;" class="mycode_b">i</span> is clearly considered a <span style="font-style: italic;" class="mycode_i">loop-counter</span> because the subject of Rule 6-5-2 is a <span style="font-style: italic;" class="mycode_i">loop-counter</span>. I am confused as to how could <span style="font-weight: bold;" class="mycode_b">i</span> could be considered a <span style="font-style: italic;" class="mycode_i">loop-counter</span> though, because it is not an operand to a relational operator in the for loop condition.<br />
<br />
Moreover, if a <span style="font-style: italic;" class="mycode_i">loop-counter</span> is defined as necessarily being an operand to a relational operator, then the point of Rule 6-5-2 is called into question. The only thing it could be applied to is when a variable is used as an operand to a relational operator (making it a <span style="font-style: italic;" class="mycode_i">loop-counter</span>) and another expression in the conditions like,<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>for ( i = 1; i != 10 &amp;&amp; i &gt; 0 ; i += 2 ) // Non-compliant</code></div></div><br />
Which is helpful for some bad behavior, but will clearly miss some fairly obvious bad behavior, like the original non-compliant example.<br />
<br />
Tangentially related the definition of <span style="font-style: italic;" class="mycode_i">loop-counter</span> contains a note explicitly saying that iterators are also valid as a <span style="font-style: italic;" class="mycode_i">loop-counter</span>. However, this note would be odd, since typically when using STL iterators in loops equality operators are used and not relational operators. So Rule 6-5-1 would flag the following as non-compliant, even though it is a common idiom.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>for (auto it = container.begin(); it != container.end(); ++it )</code></div></div>]]></description>
			<content:encoded><![CDATA[I am looking for some clarification on the first non-compliant example for Rule 6-5-2, and the overall definition of a <span style="font-style: italic;" class="mycode_i">loop-counter</span>, which as part of its definition states it must be,<br />
<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>an operand to a relational operator in condition</blockquote>
<br />
<br />
Where relational operator is defined in Rule 4-5-2, 4-5-3, and §5.9 as &lt;, &gt;, &lt;=, and &gt;=.<br />
<br />
In the non-compliant example<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>for ( i = 1; i != 10; i += 2 ) // Non-compliant</code></div></div><br />
The variable <span style="font-weight: bold;" class="mycode_b">i</span> is clearly considered a <span style="font-style: italic;" class="mycode_i">loop-counter</span> because the subject of Rule 6-5-2 is a <span style="font-style: italic;" class="mycode_i">loop-counter</span>. I am confused as to how could <span style="font-weight: bold;" class="mycode_b">i</span> could be considered a <span style="font-style: italic;" class="mycode_i">loop-counter</span> though, because it is not an operand to a relational operator in the for loop condition.<br />
<br />
Moreover, if a <span style="font-style: italic;" class="mycode_i">loop-counter</span> is defined as necessarily being an operand to a relational operator, then the point of Rule 6-5-2 is called into question. The only thing it could be applied to is when a variable is used as an operand to a relational operator (making it a <span style="font-style: italic;" class="mycode_i">loop-counter</span>) and another expression in the conditions like,<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>for ( i = 1; i != 10 &amp;&amp; i &gt; 0 ; i += 2 ) // Non-compliant</code></div></div><br />
Which is helpful for some bad behavior, but will clearly miss some fairly obvious bad behavior, like the original non-compliant example.<br />
<br />
Tangentially related the definition of <span style="font-style: italic;" class="mycode_i">loop-counter</span> contains a note explicitly saying that iterators are also valid as a <span style="font-style: italic;" class="mycode_i">loop-counter</span>. However, this note would be odd, since typically when using STL iterators in loops equality operators are used and not relational operators. So Rule 6-5-1 would flag the following as non-compliant, even though it is a common idiom.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>for (auto it = container.begin(); it != container.end(); ++it )</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[6-5-2 and 6-5-4 on while loop checking std::vector::empty()]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1585</link>
			<pubDate>Tue, 26 Oct 2021 12:14:14 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5614">cgpzs</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1585</guid>
			<description><![CDATA[Hi,<br />
<br />
We have a static analyzer that is reporting warnings related to 6-5-2 and 6-5-4 in the following code:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>    std::vector&lt;std::int32_t&gt; v{};<br />
&nbsp;&nbsp;&nbsp;&nbsp;// Fill vector<br />
&nbsp;&nbsp;&nbsp;&nbsp;// ...<br />
&nbsp;&nbsp;<br />
    // Consume vector<br />
    while (!v.empty())&nbsp;&nbsp;// &lt;&lt;&lt; 6-5-2, 6-5-4 violated here?<br />
    {<br />
        std::int32_t const value{v.back()};<br />
        v.pop_back();<br />
        std::cout &lt;&lt; value &lt;&lt; "&#92;n";<br />
    }</code></div></div><br />
The warning is that the "loop counter v" is not compared against a relational operator (6-5-2) nor is it modified via ++ et al. (6-5-4).<br />
<br />
The static analysis tool vendor claims this is not a false positive and indeed it's required by the MISRA rules.<br />
<br />
Could you shed some light as to whether the code above is violating 6-5-2 and 6-5-4? Is "v" really a loop counter as per the MISRA definition? One could argue that the loop counter is the private member std::vector::__size, but is that really the scope of this rule?<br />
<br />
This code pattern is very typical when implementing e.g. graph search, having a list of Nodes and inspecting them one by one until a condition is reached or the list of nodes is empty. The list of nodes can typically grow while inspecting each node, so iterator-based searches are not a good implementation alternative.]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
We have a static analyzer that is reporting warnings related to 6-5-2 and 6-5-4 in the following code:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>    std::vector&lt;std::int32_t&gt; v{};<br />
&nbsp;&nbsp;&nbsp;&nbsp;// Fill vector<br />
&nbsp;&nbsp;&nbsp;&nbsp;// ...<br />
&nbsp;&nbsp;<br />
    // Consume vector<br />
    while (!v.empty())&nbsp;&nbsp;// &lt;&lt;&lt; 6-5-2, 6-5-4 violated here?<br />
    {<br />
        std::int32_t const value{v.back()};<br />
        v.pop_back();<br />
        std::cout &lt;&lt; value &lt;&lt; "&#92;n";<br />
    }</code></div></div><br />
The warning is that the "loop counter v" is not compared against a relational operator (6-5-2) nor is it modified via ++ et al. (6-5-4).<br />
<br />
The static analysis tool vendor claims this is not a false positive and indeed it's required by the MISRA rules.<br />
<br />
Could you shed some light as to whether the code above is violating 6-5-2 and 6-5-4? Is "v" really a loop counter as per the MISRA definition? One could argue that the loop counter is the private member std::vector::__size, but is that really the scope of this rule?<br />
<br />
This code pattern is very typical when implementing e.g. graph search, having a list of Nodes and inspecting them one by one until a condition is reached or the list of nodes is empty. The list of nodes can typically grow while inspecting each node, so iterator-based searches are not a good implementation alternative.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Comments are needed for Rule 6-4-2? and should be placed inside the "else" block?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1571</link>
			<pubDate>Fri, 02 Apr 2021 03:02:49 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5215">chenzhuowansui</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1571</guid>
			<description><![CDATA[Hi,<br />
<br />
With regards to Rule 6-4-2<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>All if … else if constructs shall be terminated with an<br />
else clause.</blockquote>
we have some different interpretations, so could you kindly help clarify the following questions for us:<br />
1. The rule only talks about "if … else if constructs shall be terminated with an else clause." in the title, and doesn't mention anything about adding necessary comments for the else clause in the title. However, in the rationale part, it indeed mentions that the final else statement should <span style="font-weight: bold;" class="mycode_b">"either take appropriate action or contain a suitable comment"</span>, the question is: shall we take the rationale part into account to interpret this rule, more specifically, is the following code snippet compliant?<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if ( x &lt; 0 )<br />
{<br />
log_error ( 3 );<br />
x = 0;<br />
}<br />
else if ( y &lt; 0 )<br />
{<br />
x = 3;<br />
}<br />
else<br />
{<br />
}</code></div></div><br />
2. If the comments are necessary, where shall it be placed: right in the else block? or any places around the else clause, for example, are the following cases compliant?<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if ( x &lt; 0 )<br />
{<br />
log_error ( 3 );<br />
x = 0;<br />
}<br />
else if ( y &lt; 0 )<br />
{<br />
x = 3;<br />
}<br />
// No change in value of x<br />
else<br />
{<br />
}</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if ( x &lt; 0 )<br />
{<br />
log_error ( 3 );<br />
x = 0;<br />
}<br />
else if ( y &lt; 0 )<br />
{<br />
x = 3;<br />
}<br />
else // No change in value of x<br />
{<br />
}</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if ( x &lt; 0 )<br />
{<br />
log_error ( 3 );<br />
x = 0;<br />
}<br />
else if ( y &lt; 0 )<br />
{<br />
x = 3;<br />
}<br />
else<br />
// No change in value of x<br />
{<br />
}</code></div></div>Many thanks in advance!]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
With regards to Rule 6-4-2<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>All if … else if constructs shall be terminated with an<br />
else clause.</blockquote>
we have some different interpretations, so could you kindly help clarify the following questions for us:<br />
1. The rule only talks about "if … else if constructs shall be terminated with an else clause." in the title, and doesn't mention anything about adding necessary comments for the else clause in the title. However, in the rationale part, it indeed mentions that the final else statement should <span style="font-weight: bold;" class="mycode_b">"either take appropriate action or contain a suitable comment"</span>, the question is: shall we take the rationale part into account to interpret this rule, more specifically, is the following code snippet compliant?<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if ( x &lt; 0 )<br />
{<br />
log_error ( 3 );<br />
x = 0;<br />
}<br />
else if ( y &lt; 0 )<br />
{<br />
x = 3;<br />
}<br />
else<br />
{<br />
}</code></div></div><br />
2. If the comments are necessary, where shall it be placed: right in the else block? or any places around the else clause, for example, are the following cases compliant?<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if ( x &lt; 0 )<br />
{<br />
log_error ( 3 );<br />
x = 0;<br />
}<br />
else if ( y &lt; 0 )<br />
{<br />
x = 3;<br />
}<br />
// No change in value of x<br />
else<br />
{<br />
}</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if ( x &lt; 0 )<br />
{<br />
log_error ( 3 );<br />
x = 0;<br />
}<br />
else if ( y &lt; 0 )<br />
{<br />
x = 3;<br />
}<br />
else // No change in value of x<br />
{<br />
}</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if ( x &lt; 0 )<br />
{<br />
log_error ( 3 );<br />
x = 0;<br />
}<br />
else if ( y &lt; 0 )<br />
{<br />
x = 3;<br />
}<br />
else<br />
// No change in value of x<br />
{<br />
}</code></div></div>Many thanks in advance!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[6-5-4: on variable or expression?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1561</link>
			<pubDate>Fri, 29 Jan 2021 11:06:51 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5580">Nadege</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1561</guid>
			<description><![CDATA[Hello,<br />
<br />
6-5-4 says "The loop-counter shall be modified by one of: --, ++, - = n, or + = n; where n remains constant for the duration of the loop"<br />
<br />
Should this code below raise 6-5-4?<br />
<br />
int main() {<br />
    int k = 8;<br />
    <br />
    for (int j = 0; j &lt; 10; j += k + 3) { <br />
    }<br />
}<br />
<br />
If 'n' concerns variable only, I would say 'Yes'.<br />
If 'n' concerns expressions, I would say 'No'.<br />
<br />
What do you think? <br />
Thanks in advance for your help.<br />
<br />
Nadège]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
6-5-4 says "The loop-counter shall be modified by one of: --, ++, - = n, or + = n; where n remains constant for the duration of the loop"<br />
<br />
Should this code below raise 6-5-4?<br />
<br />
int main() {<br />
    int k = 8;<br />
    <br />
    for (int j = 0; j &lt; 10; j += k + 3) { <br />
    }<br />
}<br />
<br />
If 'n' concerns variable only, I would say 'Yes'.<br />
If 'n' concerns expressions, I would say 'No'.<br />
<br />
What do you think? <br />
Thanks in advance for your help.<br />
<br />
Nadège]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 6-6-3 in while-loops]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1514</link>
			<pubDate>Tue, 29 Oct 2019 07:00:26 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=4677">jungsun.goh</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1514</guid>
			<description><![CDATA[Dear MISRA members,<br />
<br />
Regarding the rule 6-6-3:<br />
Does this rule only apply to for-loops or does it also apply to while-loops?<br />
<br />
For references, the static analysis tool, Coverity reports a 6-6-3 rule violation when 'continue' statement is used in a while-loop.<br />
<br />
Best Regards,<br />
Goh]]></description>
			<content:encoded><![CDATA[Dear MISRA members,<br />
<br />
Regarding the rule 6-6-3:<br />
Does this rule only apply to for-loops or does it also apply to while-loops?<br />
<br />
For references, the static analysis tool, Coverity reports a 6-6-3 rule violation when 'continue' statement is used in a while-loop.<br />
<br />
Best Regards,<br />
Goh]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Gotos in switches and Rule 6-4-5]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1477</link>
			<pubDate>Fri, 01 Mar 2019 17:39:27 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=318">rgamble</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1477</guid>
			<description><![CDATA[Consider the following example:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>typedef unsigned short uint16_t;<br />
uint16_t foo(uint16_t x) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;switch(x) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 1:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ goto end; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 2:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++x;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp; <br />
end:<br />
&nbsp;&nbsp;&nbsp;&nbsp;++x;<br />
&nbsp;&nbsp;&nbsp;&nbsp;return x;<br />
}</code></div></div>The first case containing the <span style="font-weight: bold;" class="mycode_b">goto</span> appears to violate rule 6-4-5 which states that a case must end in a <span style="font-weight: bold;" class="mycode_b">break</span> or <span style="font-weight: bold;" class="mycode_b">throw</span> statement.  If a <span style="font-weight: bold;" class="mycode_b">break</span> is added anywhere after the <span style="font-weight: bold;" class="mycode_b">goto</span>, it will be unreachable and would seemingly violate Rule 0-1-1 which forbids unreachable code.  Rule 6-4-3 seems to consider the use of goto in a switch as it says that jump-statements (which includes <span style="font-weight: bold;" class="mycode_b">goto</span>) "are permitted within the compound statements forming the body of a switch-clause".  Is it intended that an unconditional <span style="font-weight: bold;" class="mycode_b">goto</span> in a switch will require a deviation from either 6-4-5 or 0-1-1?]]></description>
			<content:encoded><![CDATA[Consider the following example:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>typedef unsigned short uint16_t;<br />
uint16_t foo(uint16_t x) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;switch(x) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 1:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ goto end; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 2:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++x;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp; <br />
end:<br />
&nbsp;&nbsp;&nbsp;&nbsp;++x;<br />
&nbsp;&nbsp;&nbsp;&nbsp;return x;<br />
}</code></div></div>The first case containing the <span style="font-weight: bold;" class="mycode_b">goto</span> appears to violate rule 6-4-5 which states that a case must end in a <span style="font-weight: bold;" class="mycode_b">break</span> or <span style="font-weight: bold;" class="mycode_b">throw</span> statement.  If a <span style="font-weight: bold;" class="mycode_b">break</span> is added anywhere after the <span style="font-weight: bold;" class="mycode_b">goto</span>, it will be unreachable and would seemingly violate Rule 0-1-1 which forbids unreachable code.  Rule 6-4-3 seems to consider the use of goto in a switch as it says that jump-statements (which includes <span style="font-weight: bold;" class="mycode_b">goto</span>) "are permitted within the compound statements forming the body of a switch-clause".  Is it intended that an unconditional <span style="font-weight: bold;" class="mycode_b">goto</span> in a switch will require a deviation from either 6-4-5 or 0-1-1?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Chapter 6.6.5 Iteration statements]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1434</link>
			<pubDate>Fri, 06 Jul 2018 11:03:25 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5078">sklinger</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1434</guid>
			<description><![CDATA[Hello,<br />
<br />
Regarding the rules 6-5-1, 6-5-2, 6-5-3, 6-5-4, 6-5-5, 6-5-6:<br />
Do these rules only apply to for-loops or do they also apply to while-loops?<br />
<br />
best regards,<br />
Stefan]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
Regarding the rules 6-5-1, 6-5-2, 6-5-3, 6-5-4, 6-5-5, 6-5-6:<br />
Do these rules only apply to for-loops or do they also apply to while-loops?<br />
<br />
best regards,<br />
Stefan]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 6-2-1 Assignment operators shall not be used in subexpressions]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1428</link>
			<pubDate>Wed, 30 May 2018 12:44:49 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=4992">nishiyama</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1428</guid>
			<description><![CDATA[Hello.<br />
<br />
Why are the following MISRA Example compliant?<br />
Is not a sub-expression?<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if ( int16_t i = foo ( ) ) // Compliant<br />
{<br />
}</code></div></div><br />
It looks like the following, but the following are non-compliant.<br />
What are the differences?<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if ( x = y ) // Non-compliant<br />
{<br />
ã€€foo ( );<br />
}</code></div></div>]]></description>
			<content:encoded><![CDATA[Hello.<br />
<br />
Why are the following MISRA Example compliant?<br />
Is not a sub-expression?<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if ( int16_t i = foo ( ) ) // Compliant<br />
{<br />
}</code></div></div><br />
It looks like the following, but the following are non-compliant.<br />
What are the differences?<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if ( x = y ) // Non-compliant<br />
{<br />
ã€€foo ( );<br />
}</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 6-6-5 A function shall have a single point of exit at the end of function.]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1417</link>
			<pubDate>Thu, 19 Apr 2018 16:24:41 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=4857">Renan Lavarec</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1417</guid>
			<description><![CDATA[Hello,<br />
<br />
We are interested about <a href="https://www.misra.org.uk/forum/viewtopic.php?t=928" target="_blank" rel="noopener" class="mycode_url">id 0000023</a> but in C++.<br />
<br />
We would like to be MISRA compatible.<br />
But forbid multiple return in some case make the code less understandable.<br />
Further more with the use of RAII, it is pretty safe to have multiple return inside a function.<br />
This rule inherited from C where multiple return is highly unsafe is about to evolve in new version of MISRA C++ ?<br />
If not, this is a "Required" rules, could it be added to a "deviation permits" ?<br />
<br />
<br />
Example:<br />
If we transform this code using "early return pattern" method which is not MISRA on rule 6-6-5.<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>int CheckIsOk()<br />
{<br />
<br />
if (currentObject == NULL)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;return E_ERR_1;<br />
}<br />
if (!IsClassValid(id))<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;return E_ERR_2;<br />
}<br />
<br />
currentObject-&gt;test();<br />
<br />
return E_OK;<br />
}</code></div></div><br />
into MISRA<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>int CheckIsOk()<br />
{<br />
int err = E_OK;<br />
if (err == E_OK &amp;&amp; currentObject == NULL)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;err = E_ERR_1;<br />
}<br />
if (err == E_OK &amp;&amp; !IsClassValid(id))<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;err = E_ERR_2;<br />
}<br />
<br />
currentObject-&gt;test(); // Developer miss to add "err == E_OK &amp;&amp; "<br />
<br />
<br />
return err;<br />
}</code></div></div><br />
If you miss to add a test somewhere like for testing "again" currentObject before to use it, you'll get a possible crash....<br />
It increase complexity of code and make it unsecured.<br />
Readability is something very important to get trusty code.<br />
<br />
You can also transform it to another form<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>int CheckIsOk()<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;int err = E_OK;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (currentObject)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (IsClassValid(id))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currentObject-&gt;test();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;err = E_ERR_2;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;err = E_ERR_1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;// "Difficulties" to add code here<br />
&nbsp;&nbsp;&nbsp;&nbsp;if( err == E_OK)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Do something<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;return err;<br />
}</code></div></div><br />
But the readability is less good than "early return pattern", because you "jump" from "if" to "if" and the last part to execute some code is subject to errors (or after any else), if no test are added before the return statement to test the error state.<br />
<br />
<br />
ps:<br />
In MISRA 2008 document chapter 6-6-5, there is a synthax mistake on fn3, there is missing {}]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
We are interested about <a href="https://www.misra.org.uk/forum/viewtopic.php?t=928" target="_blank" rel="noopener" class="mycode_url">id 0000023</a> but in C++.<br />
<br />
We would like to be MISRA compatible.<br />
But forbid multiple return in some case make the code less understandable.<br />
Further more with the use of RAII, it is pretty safe to have multiple return inside a function.<br />
This rule inherited from C where multiple return is highly unsafe is about to evolve in new version of MISRA C++ ?<br />
If not, this is a "Required" rules, could it be added to a "deviation permits" ?<br />
<br />
<br />
Example:<br />
If we transform this code using "early return pattern" method which is not MISRA on rule 6-6-5.<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>int CheckIsOk()<br />
{<br />
<br />
if (currentObject == NULL)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;return E_ERR_1;<br />
}<br />
if (!IsClassValid(id))<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;return E_ERR_2;<br />
}<br />
<br />
currentObject-&gt;test();<br />
<br />
return E_OK;<br />
}</code></div></div><br />
into MISRA<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>int CheckIsOk()<br />
{<br />
int err = E_OK;<br />
if (err == E_OK &amp;&amp; currentObject == NULL)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;err = E_ERR_1;<br />
}<br />
if (err == E_OK &amp;&amp; !IsClassValid(id))<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;err = E_ERR_2;<br />
}<br />
<br />
currentObject-&gt;test(); // Developer miss to add "err == E_OK &amp;&amp; "<br />
<br />
<br />
return err;<br />
}</code></div></div><br />
If you miss to add a test somewhere like for testing "again" currentObject before to use it, you'll get a possible crash....<br />
It increase complexity of code and make it unsecured.<br />
Readability is something very important to get trusty code.<br />
<br />
You can also transform it to another form<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>int CheckIsOk()<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;int err = E_OK;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (currentObject)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (IsClassValid(id))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currentObject-&gt;test();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;err = E_ERR_2;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;else<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;err = E_ERR_1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;// "Difficulties" to add code here<br />
&nbsp;&nbsp;&nbsp;&nbsp;if( err == E_OK)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Do something<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;return err;<br />
}</code></div></div><br />
But the readability is less good than "early return pattern", because you "jump" from "if" to "if" and the last part to execute some code is subject to errors (or after any else), if no test are added before the return statement to test the error state.<br />
<br />
<br />
ps:<br />
In MISRA 2008 document chapter 6-6-5, there is a synthax mistake on fn3, there is missing {}]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[For Loop: must update expression use only invariants?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1390</link>
			<pubDate>Wed, 29 Nov 2017 15:47:10 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=3355">swestin</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1390</guid>
			<description><![CDATA[MISRA C:2012 Rule 14.2 puts the following restriction on the "third clause" (called "expression" in C++:2008):<br />
<br />
     Shall not use objects that are modified in the for loop body.<br />
<br />
For example, the following violates this rule:<br />
[code]<br />
    for (int i=0; i]]></description>
			<content:encoded><![CDATA[MISRA C:2012 Rule 14.2 puts the following restriction on the "third clause" (called "expression" in C++:2008):<br />
<br />
     Shall not use objects that are modified in the for loop body.<br />
<br />
For example, the following violates this rule:<br />
[code]<br />
    for (int i=0; i]]></content:encoded>
		</item>
	</channel>
</rss>