<?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 - Portal]]></title>
		<link>https://forum.misra.org.uk/</link>
		<description><![CDATA[MISRA Discussion Forums - https://forum.misra.org.uk]]></description>
		<pubDate>Thu, 05 Nov 2026 12:36:20 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Rule 0.1.1 Example f4]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1787</link>
			<pubDate>Wed, 30 Sep 2026 12:05:20 +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=1787</guid>
			<description><![CDATA[Hi,<br />
<br />
In MISRA C++:2023 TC1 Rule 0.1.1, the comment about example f4() says:<br />
<br />
<span style="font-style: italic;" class="mycode_i">As j is only incremented, no value is overwritten without first being read. Additionally, all iterations</span><br />
<span style="font-style: italic;" class="mycode_i">of the loop other than the first observe j after it has been incremented, meaning the write in the</span><br />
<span style="font-style: italic;" class="mycode_i">increment is necessary.</span><br />
<br />
This is not technically correct: the *last* iteration of the loop will *not* observe the value of j after it has been incremented. Do you consider that the last increment of "j" violates Rule 0.1.1?<br />
<br />
What about this?<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>template &lt;int n&gt;<br />
void f()<br />
{<br />
  int j = 0;<br />
  for (int i = 0; i &lt; n; ++i)<br />
  {<br />
    use(j);<br />
    j++;  // Violates Rule 0.1.1 for n == 1?<br />
  }<br />
}</code></div></div><br />
The above code never uses the incremented value of "j" for a template instantiation with "n = 1". Is that a violation of Rule 0.1.1?<br />
<hr class="mycode_hr" />
I see now that this exact use case was explicitly allowed in the original MISRA C++:2023 document, but removed in the TC1.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>Within a loop, a value may be written to an object with the intent that it will be observed during the<br />
next iteration, meaning that the value written on the last iteration may never be observed. Whilst it is<br />
possible to restructure the loop to avoid this behaviour, there is a risk that the resulting code may be<br />
of lower quality (less clear, for example). This rule therefore considers observation during any iteration<br />
to apply to all values written to such an object, including a value written during the last iteration of a<br />
loop that is not actually observed — see example f3, below.</code></div></div>]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
In MISRA C++:2023 TC1 Rule 0.1.1, the comment about example f4() says:<br />
<br />
<span style="font-style: italic;" class="mycode_i">As j is only incremented, no value is overwritten without first being read. Additionally, all iterations</span><br />
<span style="font-style: italic;" class="mycode_i">of the loop other than the first observe j after it has been incremented, meaning the write in the</span><br />
<span style="font-style: italic;" class="mycode_i">increment is necessary.</span><br />
<br />
This is not technically correct: the *last* iteration of the loop will *not* observe the value of j after it has been incremented. Do you consider that the last increment of "j" violates Rule 0.1.1?<br />
<br />
What about this?<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>template &lt;int n&gt;<br />
void f()<br />
{<br />
  int j = 0;<br />
  for (int i = 0; i &lt; n; ++i)<br />
  {<br />
    use(j);<br />
    j++;  // Violates Rule 0.1.1 for n == 1?<br />
  }<br />
}</code></div></div><br />
The above code never uses the incremented value of "j" for a template instantiation with "n = 1". Is that a violation of Rule 0.1.1?<br />
<hr class="mycode_hr" />
I see now that this exact use case was explicitly allowed in the original MISRA C++:2023 document, but removed in the TC1.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>Within a loop, a value may be written to an object with the intent that it will be observed during the<br />
next iteration, meaning that the value written on the last iteration may never be observed. Whilst it is<br />
possible to restructure the loop to avoid this behaviour, there is a risk that the resulting code may be<br />
of lower quality (less clear, for example). This rule therefore considers observation during any iteration<br />
to apply to all values written to such an object, including a value written during the last iteration of a<br />
loop that is not actually observed — see example f3, below.</code></div></div>]]></content:encoded>
		</item>
		<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[M5-0-4 switch over unscoped enum without fixed underlying type]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1785</link>
			<pubDate>Wed, 16 Sep 2026 11:08:53 +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=1785</guid>
			<description><![CDATA[Hi,<br />
<br />
Our static analyzer is flagging this code:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// third_party.h<br />
typedef enum <br />
{<br />
  FOO_A,<br />
  FOO_B<br />
} Foo;<br />
<br />
// main.cpp<br />
#include &lt;third_party.h&gt;<br />
<br />
int get(Foo x)<br />
{<br />
  switch(x)            // Non-compliant with M5-0-4 ?<br />
  {<br />
    case FOO_A:        // Non-compliant with M5-0-4 ?<br />
      return 123;<br />
    case FOO_B:        // Non-compliant with M5-0-4 ?<br />
      return 321;<br />
  }<br />
  return -1;<br />
}</code></div></div><br />
The rationale from the supplier is:<br />
<ul class="mycode_list"><li>"Foo" is an unscoped enum without fixed underlying type.<br />
</li>
<li>Thus, its underlying type is implementation-defined.<br />
</li>
<li>On this implementation, the actual type is "unsigned int".<br />
</li>
<li>The line with "switch(x)" performs an integral promotion of "x" to "int", <span style="font-weight: bold;" class="mycode_b">thus changing the signedness</span> from "unsigned int" to "int".<br />
</li>
<li>Similarly, the "case FOO_*" lines also perform an integral promotion to "int".<br />
</li>
<li>This change in signedness is a violation of M5-0-4.<br />
</li>
</ul>
<br />
We argue however that the code is perfectly safe and idiomatic, the Standard guarantees that the conversion is made to an integer able to hold all the values of the enumerator, so it's impossible for data loss to occur.<br />
<br />
What is your opinion, is M5-0-4 truly applicable in this case?<br />
<br />
Thanks!]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
Our static analyzer is flagging this code:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>// third_party.h<br />
typedef enum <br />
{<br />
  FOO_A,<br />
  FOO_B<br />
} Foo;<br />
<br />
// main.cpp<br />
#include &lt;third_party.h&gt;<br />
<br />
int get(Foo x)<br />
{<br />
  switch(x)            // Non-compliant with M5-0-4 ?<br />
  {<br />
    case FOO_A:        // Non-compliant with M5-0-4 ?<br />
      return 123;<br />
    case FOO_B:        // Non-compliant with M5-0-4 ?<br />
      return 321;<br />
  }<br />
  return -1;<br />
}</code></div></div><br />
The rationale from the supplier is:<br />
<ul class="mycode_list"><li>"Foo" is an unscoped enum without fixed underlying type.<br />
</li>
<li>Thus, its underlying type is implementation-defined.<br />
</li>
<li>On this implementation, the actual type is "unsigned int".<br />
</li>
<li>The line with "switch(x)" performs an integral promotion of "x" to "int", <span style="font-weight: bold;" class="mycode_b">thus changing the signedness</span> from "unsigned int" to "int".<br />
</li>
<li>Similarly, the "case FOO_*" lines also perform an integral promotion to "int".<br />
</li>
<li>This change in signedness is a violation of M5-0-4.<br />
</li>
</ul>
<br />
We argue however that the code is perfectly safe and idiomatic, the Standard guarantees that the conversion is made to an integer able to hold all the values of the enumerator, so it's impossible for data loss to occur.<br />
<br />
What is your opinion, is M5-0-4 truly applicable in this case?<br />
<br />
Thanks!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 8-4-4 Exception for stream manipulators?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1782</link>
			<pubDate>Mon, 07 Sep 2026 08:22:54 +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=1782</guid>
			<description><![CDATA[Hi,<br />
<br />
Does Rule 8-4-4 imply that we have to write code like this? I do not see any exception for stream manipulators. Our static analyzer is flagging this case.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>std::cout &lt;&lt; "Hello World" &lt;&lt; &amp;std::endl;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^</code></div></div>]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
Does Rule 8-4-4 imply that we have to write code like this? I do not see any exception for stream manipulators. Our static analyzer is flagging this case.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>std::cout &lt;&lt; "Hello World" &lt;&lt; &amp;std::endl;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[13.3 Should side effects be allowed in comma expressions?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1781</link>
			<pubDate>Mon, 31 Aug 2026 12:52:23 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=6753">Loïc</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1781</guid>
			<description><![CDATA[In a comma expression (which is discouraged by another advisory rule, 12.3, but could still be used), there is a clear separation in term of execution between what comes before and what comes after the comma. Therefore, I think the rationale is not very strong in this case.<br />
<br />
What would you think of relaxing 13.3 and making this example compliant (it would still be non-compliant with 12.3):<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>int f(int n, int*dest) {<br />
    for (int i = 0 ; i&lt;10 ; ++i, ++dest) { // Currently non-compliant<br />
        *dest = i*i;<br />
    }<br />
}</code></div></div>]]></description>
			<content:encoded><![CDATA[In a comma expression (which is discouraged by another advisory rule, 12.3, but could still be used), there is a clear separation in term of execution between what comes before and what comes after the comma. Therefore, I think the rationale is not very strong in this case.<br />
<br />
What would you think of relaxing 13.3 and making this example compliant (it would still be non-compliant with 12.3):<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>int f(int n, int*dest) {<br />
    for (int i = 0 ; i&lt;10 ; ++i, ++dest) { // Currently non-compliant<br />
        *dest = i*i;<br />
    }<br />
}</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[13.3 What not being evaluated means?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1780</link>
			<pubDate>Fri, 28 Aug 2026 16:19:16 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=6753">Loïc</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1780</guid>
			<description><![CDATA[Hi there,<br />
<br />
Rule 13.3 says:<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>All sub-expressions of the <span style="font-style: italic;" class="mycode_i">full expression</span> are treated as if they were evaluated for the purposes of this rule, even if specified as not being evaluated by the C Standard.</blockquote>
<br />
I understand what it makes sense in the context for instance of the conditional operator, but I wanted to check it this applies the sub-expressions that can be determined as never evaluated because they are in non-evaluated operands.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>int f(int a) {<br />
    volatile int i;<br />
    return ++a + sizeof(i); <br />
}</code></div></div> <br />
Accessing the volatile variable i is a persistent side effect, but since this access happens as part of a sizeof operand, that is not evaluated, no actual access to the volatile actually happens.<br />
<br />
Would it make sense to update this rule (and several other that use similar wording) to separate the undecidable case of infeasible paths from the very decidable case of non-evaluated expressions?<br />
<br />
FYI, in similar cases, MISRA C++ uses wording such as " even if they occur in an infeasible path" instead of "even if specified as not being evaluated".]]></description>
			<content:encoded><![CDATA[Hi there,<br />
<br />
Rule 13.3 says:<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>All sub-expressions of the <span style="font-style: italic;" class="mycode_i">full expression</span> are treated as if they were evaluated for the purposes of this rule, even if specified as not being evaluated by the C Standard.</blockquote>
<br />
I understand what it makes sense in the context for instance of the conditional operator, but I wanted to check it this applies the sub-expressions that can be determined as never evaluated because they are in non-evaluated operands.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>int f(int a) {<br />
    volatile int i;<br />
    return ++a + sizeof(i); <br />
}</code></div></div> <br />
Accessing the volatile variable i is a persistent side effect, but since this access happens as part of a sizeof operand, that is not evaluated, no actual access to the volatile actually happens.<br />
<br />
Would it make sense to update this rule (and several other that use similar wording) to separate the undecidable case of infeasible paths from the very decidable case of non-evaluated expressions?<br />
<br />
FYI, in similar cases, MISRA C++ uses wording such as " even if they occur in an infeasible path" instead of "even if specified as not being evaluated".]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Clarification Rule 0.2.1]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1779</link>
			<pubDate>Thu, 27 Aug 2026 11:32:03 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5889">hahn</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1779</guid>
			<description><![CDATA[Hi,<br />
<br />
I have a question regarding rule 0.2.1 on the following code:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>namespace {<br />
<br />
struct Base {<br />
  Base() {<br />
    // do resource management<br />
  }<br />
};<br />
<br />
struct Derived : public Base {<br />
  // has implicit default constructor that calls user-provided Base()<br />
};<br />
<br />
Base b; // (1) compliant<br />
Derived d; // (2) compliant or non-compliant for rule 0.2.1 ?<br />
<br />
}</code></div></div><br />
Case (1) is clearly compliant as b has class type Base and Base has a user-provided constructor.<br />
Case (2) is unclear, as the default constructor of Derived is not user-provided, if I understand the C++ standard correctly, as the user does not declare it at all.<br />
Still case (2) seems fine and in line with the rule's rationale.<br />
<br />
It would be great to get a clarification whether case (2) is considered compliant or not, and if compliant, what the intended definition of "use" should be.<br />
Thanks a lot!]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
I have a question regarding rule 0.2.1 on the following code:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>namespace {<br />
<br />
struct Base {<br />
  Base() {<br />
    // do resource management<br />
  }<br />
};<br />
<br />
struct Derived : public Base {<br />
  // has implicit default constructor that calls user-provided Base()<br />
};<br />
<br />
Base b; // (1) compliant<br />
Derived d; // (2) compliant or non-compliant for rule 0.2.1 ?<br />
<br />
}</code></div></div><br />
Case (1) is clearly compliant as b has class type Base and Base has a user-provided constructor.<br />
Case (2) is unclear, as the default constructor of Derived is not user-provided, if I understand the C++ standard correctly, as the user does not declare it at all.<br />
Still case (2) seems fine and in line with the rule's rationale.<br />
<br />
It would be great to get a clarification whether case (2) is considered compliant or not, and if compliant, what the intended definition of "use" should be.<br />
Thanks a lot!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[20.12 Does the stringification really matter?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1778</link>
			<pubDate>Tue, 07 Jul 2026 09:59:02 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=6753">Loïc</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1778</guid>
			<description><![CDATA[Hello,<br />
<br />
While looking at violations of 20.12 <span style="font-style: italic;" class="mycode_i">A macro parameter used as an operand to the "#" or "##" operators, which is itself subject to further macro replacement, shall only be used as an operand to these operators</span>, I discovered that most of them were of the form:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>assert(value &lt; LIMIT)</code></div></div><br />
Indeed, the macro parameter of <span style="font-weight: bold;" class="mycode_b">assert</span> is typically stringified, and in that case it contains the macro <span style="font-weight: bold;" class="mycode_b">LIMIT </span>that is itself subject to further replacement.<br />
<br />
However, I don't see the safety case for this violation. The fact that the unexpended version of the macro will appear in the string is exactly what is needed.<br />
<br />
I agree that with token pasting (<span style="font-weight: bold;" class="mycode_b">##</span>), this situation could lead to hard to understand code, but not with stringification.<br />
<br />
FWIW, I discussed this with MISRA C++ (that contains the same rule), and the sentiment of the group was that the rule should be updated to remove the stringification part.<br />
<br />
<br />
What do you think?]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
While looking at violations of 20.12 <span style="font-style: italic;" class="mycode_i">A macro parameter used as an operand to the "#" or "##" operators, which is itself subject to further macro replacement, shall only be used as an operand to these operators</span>, I discovered that most of them were of the form:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>assert(value &lt; LIMIT)</code></div></div><br />
Indeed, the macro parameter of <span style="font-weight: bold;" class="mycode_b">assert</span> is typically stringified, and in that case it contains the macro <span style="font-weight: bold;" class="mycode_b">LIMIT </span>that is itself subject to further replacement.<br />
<br />
However, I don't see the safety case for this violation. The fact that the unexpended version of the macro will appear in the string is exactly what is needed.<br />
<br />
I agree that with token pasting (<span style="font-weight: bold;" class="mycode_b">##</span>), this situation could lead to hard to understand code, but not with stringification.<br />
<br />
FWIW, I discussed this with MISRA C++ (that contains the same rule), and the sentiment of the group was that the rule should be updated to remove the stringification part.<br />
<br />
<br />
What do you think?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Does rule A2-10-5 apply to reusing an external identifier as a member identifier?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1777</link>
			<pubDate>Mon, 06 Jul 2026 12:23:34 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5807">mstaron</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1777</guid>
			<description><![CDATA[Rule A2-10-5 states: Regardless of scope, no identifier with static storage duration should be reused across any source files in the project. Are cases where an identifier is reused as a member non-compliant with this rule? In particular, the case where an operator function is defined as a global and a member function.<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>struct S<br />
{<br />
&nbsp;&nbsp;void operator&lt;&lt;(S&amp;) {}<br />
&nbsp;&nbsp;void f1(int par) {}<br />
};<br />
<br />
namespace N<br />
{<br />
&nbsp;&nbsp;void operator&lt;&lt;(int i, S&amp;) {}&nbsp;&nbsp;// Is compliant or non-compliant?<br />
&nbsp;&nbsp;void f1(int par) {}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Is compliant or non-compliant?<br />
}</code></div></div>]]></description>
			<content:encoded><![CDATA[Rule A2-10-5 states: Regardless of scope, no identifier with static storage duration should be reused across any source files in the project. Are cases where an identifier is reused as a member non-compliant with this rule? In particular, the case where an operator function is defined as a global and a member function.<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>struct S<br />
{<br />
&nbsp;&nbsp;void operator&lt;&lt;(S&amp;) {}<br />
&nbsp;&nbsp;void f1(int par) {}<br />
};<br />
<br />
namespace N<br />
{<br />
&nbsp;&nbsp;void operator&lt;&lt;(int i, S&amp;) {}&nbsp;&nbsp;// Is compliant or non-compliant?<br />
&nbsp;&nbsp;void f1(int par) {}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Is compliant or non-compliant?<br />
}</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Is Fn4 example in AUTOSAR rule A7-5-2 correct?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1776</link>
			<pubDate>Thu, 02 Jul 2026 10:49:49 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=6775">limdor</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1776</guid>
			<description><![CDATA[<span style="font-family: 'Open Sans', sans-serif;" class="mycode_font">AUTOSAR rule A7-5-2 has the following example:</span><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>std::int32_t Fn4(std::int32_t number) <br />
{ <br />
  if (number == 1) <br />
  {<br />
    number = number * Fn3(number - 1);  // Non-compliant <br />
  } &nbsp;&nbsp;<br />
  return number; <br />
}</code></div></div> <span style="font-family: 'Open Sans', sans-serif;" class="mycode_font">Fn3 is a recursive function and thus non-compliant. Fn4 is making a call to Fn3. However, in this line, the function is not calling itself. Why is this line Non-compliant? Is this an issue with the example?</span>]]></description>
			<content:encoded><![CDATA[<span style="font-family: 'Open Sans', sans-serif;" class="mycode_font">AUTOSAR rule A7-5-2 has the following example:</span><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>std::int32_t Fn4(std::int32_t number) <br />
{ <br />
  if (number == 1) <br />
  {<br />
    number = number * Fn3(number - 1);  // Non-compliant <br />
  } &nbsp;&nbsp;<br />
  return number; <br />
}</code></div></div> <span style="font-family: 'Open Sans', sans-serif;" class="mycode_font">Fn3 is a recursive function and thus non-compliant. Fn4 is making a call to Fn3. However, in this line, the function is not calling itself. Why is this line Non-compliant? Is this an issue with the example?</span>]]></content:encoded>
		</item>
	</channel>
</rss>