<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[MISRA Discussion Forums - 8.22 Resources]]></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:31 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Rule 22.1:  object declaration and deleted timing]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1540</link>
			<pubDate>Mon, 04 May 2020 01:10:21 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5441">andy_su</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1540</guid>
			<description><![CDATA[Hi, I have a question about object declaration and deleted timing.<br />
I need to declare an object in constructor and release it in deconstructor, because the object will be reused frequently, but it is not compliant on MISRA C 2012.<br />
The sample code as below.<br />
Could you give me any hint to solve it?<br />
Thanks.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>ABC::aa(const Arguments&amp; args)<br />
{ <br />
&nbsp;&nbsp;&nbsp;&nbsp;pImpl = new ABC::impl(args); <br />
}<br />
<br />
ABC::~aa() <br />
{ <br />
&nbsp;&nbsp;&nbsp;&nbsp;delete pImpl; <br />
&nbsp;&nbsp;&nbsp;&nbsp;pImpl = NULL;<br />
}</code></div></div>]]></description>
			<content:encoded><![CDATA[Hi, I have a question about object declaration and deleted timing.<br />
I need to declare an object in constructor and release it in deconstructor, because the object will be reused frequently, but it is not compliant on MISRA C 2012.<br />
The sample code as below.<br />
Could you give me any hint to solve it?<br />
Thanks.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>ABC::aa(const Arguments&amp; args)<br />
{ <br />
&nbsp;&nbsp;&nbsp;&nbsp;pImpl = new ABC::impl(args); <br />
}<br />
<br />
ABC::~aa() <br />
{ <br />
&nbsp;&nbsp;&nbsp;&nbsp;delete pImpl; <br />
&nbsp;&nbsp;&nbsp;&nbsp;pImpl = NULL;<br />
}</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Typo in rule 22.9]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1484</link>
			<pubDate>Thu, 28 Mar 2019 15:49:42 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5241">gwd</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1484</guid>
			<description><![CDATA[I recently downloaded MISRA C:2012, third edition, first revision, February 2019.  The text for Rule 22.9 on page 190 says, "The value of errno shall be <span style="font-weight: bold;" class="mycode_b">set to zero</span> after calling an errno-setting-function" (emphasis mine).  But the amplification, rationale, and exception all seem to deal with the <span style="font-style: italic;" class="mycode_i">testing</span> of errno, not the <span style="font-style: italic;" class="mycode_i">setting</span> of errno.  The rule in Appendix A (on page 203) says, "..shall be tested against zero...", as does the version of the rule in the 2016 addendum.  Seems like the text on page 190 probably needs to be fixed.]]></description>
			<content:encoded><![CDATA[I recently downloaded MISRA C:2012, third edition, first revision, February 2019.  The text for Rule 22.9 on page 190 says, "The value of errno shall be <span style="font-weight: bold;" class="mycode_b">set to zero</span> after calling an errno-setting-function" (emphasis mine).  But the amplification, rationale, and exception all seem to deal with the <span style="font-style: italic;" class="mycode_i">testing</span> of errno, not the <span style="font-style: italic;" class="mycode_i">setting</span> of errno.  The rule in Appendix A (on page 203) says, "..shall be tested against zero...", as does the version of the rule in the 2016 addendum.  Seems like the text on page 190 probably needs to be fixed.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Conditional stream opening and 22.3?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=969</link>
			<pubDate>Fri, 12 Jul 2013 16:05:32 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=64">gs</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=969</guid>
			<description><![CDATA[Does the rule prohibit cases like the following:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if( someCondition )<br />
&nbsp;&nbsp;&nbsp;&nbsp;f = fopen( "apple", "r+" );<br />
else<br />
&nbsp;&nbsp;&nbsp;&nbsp;f = fopen( "apple", "r" );<br />
g = fopen( "apple", "r+" );</code></div></div>]]></description>
			<content:encoded><![CDATA[Does the rule prohibit cases like the following:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if( someCondition )<br />
&nbsp;&nbsp;&nbsp;&nbsp;f = fopen( "apple", "r+" );<br />
else<br />
&nbsp;&nbsp;&nbsp;&nbsp;f = fopen( "apple", "r" );<br />
g = fopen( "apple", "r+" );</code></div></div>]]></content:encoded>
		</item>
	</channel>
</rss>