<?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.21 Standard libraries]]></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:48 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[21.18 is a safe strncpy function call non-compliant?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1650</link>
			<pubDate>Thu, 15 Jun 2023 13:06:38 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=6164">dunno</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1650</guid>
			<description><![CDATA[I have a philosophical question.<br />
<br />
<br />
Example code:<br />
<br />
void foo() {<br />
    char buf[128];<br />
    strncpy(buf, "hello", 128);<br />
}<br />
<br />
The strncpy call does not have any undefined behavior. It will write "hello" in the buffer. Writing 6 bytes in a 128 byte buffer is not undefined behavior.<br />
<br />
Does this code then violate rule 21.18? The third argument is larger than the size of the string literal.<br />
<br />
Reading the amplification, it seems to me the code in non-compliant.<br />
<br />
Reading the rationale, the point of this rule is to avoid buffer overflows. Since there is no buffer overflow does it mean the code is compliant?]]></description>
			<content:encoded><![CDATA[I have a philosophical question.<br />
<br />
<br />
Example code:<br />
<br />
void foo() {<br />
    char buf[128];<br />
    strncpy(buf, "hello", 128);<br />
}<br />
<br />
The strncpy call does not have any undefined behavior. It will write "hello" in the buffer. Writing 6 bytes in a 128 byte buffer is not undefined behavior.<br />
<br />
Does this code then violate rule 21.18? The third argument is larger than the size of the string literal.<br />
<br />
Reading the amplification, it seems to me the code in non-compliant.<br />
<br />
Reading the rationale, the point of this rule is to avoid buffer overflows. Since there is no buffer overflow does it mean the code is compliant?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 21.8, assert, and abort]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1550</link>
			<pubDate>Mon, 02 Nov 2020 22:21:24 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=2549">michael.metivier</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1550</guid>
			<description><![CDATA[Does the prohibition on calling the termination functions, specifically "abort", given by Rule 21.8 apply for any process that may arrive at abort?  Or only to direct calls to abort requested by user-written code?  This is of interest due to the definition of assert which indicates that it calls the "abort" function if the assert fails.  Does 21.8, then, prohibit the use of assert?]]></description>
			<content:encoded><![CDATA[Does the prohibition on calling the termination functions, specifically "abort", given by Rule 21.8 apply for any process that may arrive at abort?  Or only to direct calls to abort requested by user-written code?  This is of interest due to the definition of assert which indicates that it calls the "abort" function if the assert fails.  Does 21.8, then, prohibit the use of assert?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Shall Rule 21.1 apply to the both paths of conditional preprocessing]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1532</link>
			<pubDate>Wed, 04 Mar 2020 02:28:02 +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=1532</guid>
			<description><![CDATA[Hi there,<br />
Rule 21.1 doesn't mention anything about preprocessing, so given the following code<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#define ABC 345<br />
<br />
#ifdef ABC<br />
#define _XYZ 0xFFFFFFFF&nbsp;&nbsp;&nbsp;&nbsp;//defect1<br />
#else<br />
#define _XYZ 0xF0000000&nbsp;&nbsp;//defect2<br />
#endif</code></div></div><br />
shall we report both the above defects or only the one(defec1) in the true path?<br />
<br />
thanks]]></description>
			<content:encoded><![CDATA[Hi there,<br />
Rule 21.1 doesn't mention anything about preprocessing, so given the following code<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#define ABC 345<br />
<br />
#ifdef ABC<br />
#define _XYZ 0xFFFFFFFF&nbsp;&nbsp;&nbsp;&nbsp;//defect1<br />
#else<br />
#define _XYZ 0xF0000000&nbsp;&nbsp;//defect2<br />
#endif</code></div></div><br />
shall we report both the above defects or only the one(defec1) in the true path?<br />
<br />
thanks]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rules 21.1 and 21.2. Possible contradiction with rule 11.9 and directive 4.6.]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1474</link>
			<pubDate>Fri, 22 Feb 2019 19:44:10 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5112">l.inc</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1474</guid>
			<description><![CDATA[Good day. I'm analyzing a few findings reported by a static analysis tool for a project that per project guidelines disallows any use of standard libraries. This maximizes control over the code and makes all the project code subject to MISRA C compliance. To comply with MISRA C:2012 and to avoid possible clashes with unit testing frameworks that do make use of standard libraries the internal standard-like macros and functions (like "offsetof" and "memcpy") have customized names.<br />
<br />
Problems arise when trying to adhere to the rule 11.9 by defining the macro "NULL" and to the directive 4.6 by defining the exact-width integer types. These rules prescribe the use of standard names while the rules 21.1 and 21.2 prohibit such definitions. The project employs static assertions to guarantee that all the standard properties of the exact-width integer types and other integer types (like "size_t" and "ptrdiff_t") hold true for whatever (32-bit or 64-bit) target the project is compiled. The project is C99-specific, and I assume the MISRA C Working Group would rightfully point out that the directive 4.6 recommends inclusion of "stdint.h" in this case and therefore does not strictly contradict the rule 21.2 due to the standard headers being out of the MISRA C compliance scope. In any case the rationale of the rule 21.2 does not seem to apply here, as the typedef-names have no linkage and are therefore not reserved as per "C99. 7.1.3 Reserved identifiers" as long as no associated header is included.<br />
<br />
My questions are:<br />
1) How can the contradiction between the rules 11.9 and 21.1 be resolved with respect to the macro "NULL" in the context of the given project?<br />
2) How can the contradiction between the directive 4.6 and the rule 21.2 be resolved with respect to the exact-width integer types in the context of the given project?<br />
3) Rule 21.1 acknowledges that defining identifiers being subject to the question 2 "is well-defined provided that the header is not included", but still prohibits such definitions to avoid confusion. Does this prohibition also apply for the rule 21.2? What exactly causes confusion provided all the properties guaranteed by the standard are also ensured for the definitions made outside of the standard headers?<br />
<br />
Kind regards]]></description>
			<content:encoded><![CDATA[Good day. I'm analyzing a few findings reported by a static analysis tool for a project that per project guidelines disallows any use of standard libraries. This maximizes control over the code and makes all the project code subject to MISRA C compliance. To comply with MISRA C:2012 and to avoid possible clashes with unit testing frameworks that do make use of standard libraries the internal standard-like macros and functions (like "offsetof" and "memcpy") have customized names.<br />
<br />
Problems arise when trying to adhere to the rule 11.9 by defining the macro "NULL" and to the directive 4.6 by defining the exact-width integer types. These rules prescribe the use of standard names while the rules 21.1 and 21.2 prohibit such definitions. The project employs static assertions to guarantee that all the standard properties of the exact-width integer types and other integer types (like "size_t" and "ptrdiff_t") hold true for whatever (32-bit or 64-bit) target the project is compiled. The project is C99-specific, and I assume the MISRA C Working Group would rightfully point out that the directive 4.6 recommends inclusion of "stdint.h" in this case and therefore does not strictly contradict the rule 21.2 due to the standard headers being out of the MISRA C compliance scope. In any case the rationale of the rule 21.2 does not seem to apply here, as the typedef-names have no linkage and are therefore not reserved as per "C99. 7.1.3 Reserved identifiers" as long as no associated header is included.<br />
<br />
My questions are:<br />
1) How can the contradiction between the rules 11.9 and 21.1 be resolved with respect to the macro "NULL" in the context of the given project?<br />
2) How can the contradiction between the directive 4.6 and the rule 21.2 be resolved with respect to the exact-width integer types in the context of the given project?<br />
3) Rule 21.1 acknowledges that defining identifiers being subject to the question 2 "is well-defined provided that the header is not included", but still prohibits such definitions to avoid confusion. Does this prohibition also apply for the rule 21.2? What exactly causes confusion provided all the properties guaranteed by the standard are also ensured for the definitions made outside of the standard headers?<br />
<br />
Kind regards]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Doubts about Rule 21.3 and 21.8]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1473</link>
			<pubDate>Thu, 21 Feb 2019 02:32:30 +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=1473</guid>
			<description><![CDATA[Hello,<br />
<br />
We have some doubts about Rule 21.3 and Rule 21.8, please help clarify<br />
<br />
Rule 21.3 The memory allocation and deallocation functions of  shall not be used<br />
Rule 21.8  The library functions abort, exit, getenv and system of  shall not be used<br />
<br />
From the titles and Rationale of these two rules, they are talking about only functions with the forbidden identifiers, but in the Amplification of these two rules, all these identifiers and macros are forbidden including using these identifiers to define variables or fields of structs. So my question is that can we use these identifiers in the following cases:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>int free = 0; //Violate Rule 21.3?<br />
struct s {<br />
&nbsp;&nbsp;&nbsp;&nbsp;int free;&nbsp;&nbsp; //Violate Rule 21.3?<br />
&nbsp;&nbsp;&nbsp;&nbsp;int malloc; //Violate Rule 21.3?<br />
&nbsp;&nbsp;&nbsp;&nbsp;int exit; //Violate Rule 21.8?<br />
&nbsp;&nbsp;&nbsp;&nbsp;};</code></div></div><br />
Please help clarify, thanks a lot!]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
We have some doubts about Rule 21.3 and Rule 21.8, please help clarify<br />
<br />
Rule 21.3 The memory allocation and deallocation functions of  shall not be used<br />
Rule 21.8  The library functions abort, exit, getenv and system of  shall not be used<br />
<br />
From the titles and Rationale of these two rules, they are talking about only functions with the forbidden identifiers, but in the Amplification of these two rules, all these identifiers and macros are forbidden including using these identifiers to define variables or fields of structs. So my question is that can we use these identifiers in the following cases:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>int free = 0; //Violate Rule 21.3?<br />
struct s {<br />
&nbsp;&nbsp;&nbsp;&nbsp;int free;&nbsp;&nbsp; //Violate Rule 21.3?<br />
&nbsp;&nbsp;&nbsp;&nbsp;int malloc; //Violate Rule 21.3?<br />
&nbsp;&nbsp;&nbsp;&nbsp;int exit; //Violate Rule 21.8?<br />
&nbsp;&nbsp;&nbsp;&nbsp;};</code></div></div><br />
Please help clarify, thanks a lot!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[How do explicit casts of arguments affect 21.15 (amendment 1)?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1415</link>
			<pubDate>Mon, 09 Apr 2018 19:45:39 +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=1415</guid>
			<description><![CDATA[When rule 21.15 of MISRA C 2012 Amendment 1 refers to the types that pointer arguments are pointers to, how are explicit casts interpreted? Are the types that they are pointers to considered before or after the cast?<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>void f(signed char* a, int* b, size_t n) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp(a, a, n); // ok - pointers to same type<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp(b, b, n); // ok - pointers to same type<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp((int*)b, (int*)b, n); // ok - same type and cast has no effect<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp((int*)a, (int*)a, n); // ok? - cast to different pointer type, arguments match before and after but with different matching types<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp(a, b, n); // violation - pointers to different types<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp((int*)a, b, n); // violation? - types only match due to pointer cast<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp((float*)a, (float*)b, n); // violation? - different pointer types cast to third common pointer type<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp((short*)a, a, n); // violation? - original pointer types match before cast<br />
}</code></div></div>]]></description>
			<content:encoded><![CDATA[When rule 21.15 of MISRA C 2012 Amendment 1 refers to the types that pointer arguments are pointers to, how are explicit casts interpreted? Are the types that they are pointers to considered before or after the cast?<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>void f(signed char* a, int* b, size_t n) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp(a, a, n); // ok - pointers to same type<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp(b, b, n); // ok - pointers to same type<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp((int*)b, (int*)b, n); // ok - same type and cast has no effect<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp((int*)a, (int*)a, n); // ok? - cast to different pointer type, arguments match before and after but with different matching types<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp(a, b, n); // violation - pointers to different types<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp((int*)a, b, n); // violation? - types only match due to pointer cast<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp((float*)a, (float*)b, n); // violation? - different pointer types cast to third common pointer type<br />
&nbsp;&nbsp;&nbsp;&nbsp;memcmp((short*)a, a, n); // violation? - original pointer types match before cast<br />
}</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Use reserved identifier as input parameter of function]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1341</link>
			<pubDate>Tue, 25 Apr 2017 06:25:49 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=4042">lai56</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1341</guid>
			<description><![CDATA[Hello,<br />
<br />
It is defined in the Rule 21.2 that reserved identifier from standard library should not be used.<br />
<br />
I have following example for a function definition.<br />
void func_a (uint8 time)<br />
<br />
time is reserved identifier from time.h, but it is used as input paramter for the function syntax. does it violate the rule 21.2?<br />
<br />
Thanks<br />
Lai]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
It is defined in the Rule 21.2 that reserved identifier from standard library should not be used.<br />
<br />
I have following example for a function definition.<br />
void func_a (uint8 time)<br />
<br />
time is reserved identifier from time.h, but it is used as input paramter for the function syntax. does it violate the rule 21.2?<br />
<br />
Thanks<br />
Lai]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 21.18 (Amendment) - Use of '0']]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1316</link>
			<pubDate>Fri, 24 Feb 2017 15:21:05 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=4406">RichardC</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1316</guid>
			<description><![CDATA[The rationale provided for this rule is to avoid reading or writing passed the bounds of an object argument, resulting in "undefined behavior".<br />
<br />
The Amplification specifies that the value be "positive".  However, that can be interpreted as "greater than" zero.  However, according the to C standard (C99 7.21.1/2) it is well defined to call these functions with a value of 0:<br />
<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>Where an argument declared as size_t n specifies the length of the array for a function, n can have the value zero on a call to that function. Unless explicitly stated otherwise in the description of a particular function in this subclause, pointer arguments on such a call shall still have valid values, as described in 7.1.4. On such a call, a function that locates a character finds no occurrence, a function that compares two character sequences returns zero, and a function that copies characters copies zero characters.</blockquote>
<br />
1) Given that 0 has well-defined meaning, does 'positive' imply "greater than zero" or "greater than or equal to zero"?<br />
<br />
2) If positive refers to "greater than zero", is there an example or rationale for excluding this well-defined behavior?<br />
<br />
<br />
Many Thanks.]]></description>
			<content:encoded><![CDATA[The rationale provided for this rule is to avoid reading or writing passed the bounds of an object argument, resulting in "undefined behavior".<br />
<br />
The Amplification specifies that the value be "positive".  However, that can be interpreted as "greater than" zero.  However, according the to C standard (C99 7.21.1/2) it is well defined to call these functions with a value of 0:<br />
<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>Where an argument declared as size_t n specifies the length of the array for a function, n can have the value zero on a call to that function. Unless explicitly stated otherwise in the description of a particular function in this subclause, pointer arguments on such a call shall still have valid values, as described in 7.1.4. On such a call, a function that locates a character finds no occurrence, a function that compares two character sequences returns zero, and a function that copies characters copies zero characters.</blockquote>
<br />
1) Given that 0 has well-defined meaning, does 'positive' imply "greater than zero" or "greater than or equal to zero"?<br />
<br />
2) If positive refers to "greater than zero", is there an example or rationale for excluding this well-defined behavior?<br />
<br />
<br />
Many Thanks.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[A question for Rule21.8]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1076</link>
			<pubDate>Mon, 14 Jul 2014 06:28:49 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=3258">tsukukazu</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1076</guid>
			<description><![CDATA[Hello.<br />
<br />
I have a question about rule 21.8.<br />
<br />
_Exit Function that were added in C99 also has implementation-defined behavior.<br />
<br />
Is this not included?<br />
<br />
Best regards,<br />
 Kazuhiro Tsukushiro]]></description>
			<content:encoded><![CDATA[Hello.<br />
<br />
I have a question about rule 21.8.<br />
<br />
_Exit Function that were added in C99 also has implementation-defined behavior.<br />
<br />
Is this not included?<br />
<br />
Best regards,<br />
 Kazuhiro Tsukushiro]]></content:encoded>
		</item>
		<item>
			<title><![CDATA["See Also" in Rule 21.1]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1060</link>
			<pubDate>Thu, 05 Jun 2014 06:57:11 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=3258">tsukukazu</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1060</guid>
			<description><![CDATA[This rule is related to "#undef".<br />
But "See also" of this rule does not contain "Rule 20.5 # undef should not be used". <br />
I think Rule 20.5 should be included in "See also".<br />
<br />
Is it correct?<br />
<br />
Best Regards.]]></description>
			<content:encoded><![CDATA[This rule is related to "#undef".<br />
But "See also" of this rule does not contain "Rule 20.5 # undef should not be used". <br />
I think Rule 20.5 should be included in "See also".<br />
<br />
Is it correct?<br />
<br />
Best Regards.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Phrase in Rule 21.7 and Rule 21.8]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1058</link>
			<pubDate>Thu, 22 May 2014 05:52:43 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=114">ogawa.kiyoshi</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1058</guid>
			<description><![CDATA[Rule 21.7 The atof, atoi, atol and atoll functions of  shall not be used.<br />
Rule 21.8 The library functions abort, exit getenv and system of  shall not be used.<br />
<br />
If the purpose of the rules are same, wording should be same in the standard document.<br />
<br />
 "The Standard Library" or "The library" , also.]]></description>
			<content:encoded><![CDATA[Rule 21.7 The atof, atoi, atol and atoll functions of  shall not be used.<br />
Rule 21.8 The library functions abort, exit getenv and system of  shall not be used.<br />
<br />
If the purpose of the rules are same, wording should be same in the standard document.<br />
<br />
 "The Standard Library" or "The library" , also.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Words in Rule 21.1 and 21.2]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1057</link>
			<pubDate>Thu, 22 May 2014 05:21:05 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=114">ogawa.kiyoshi</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1057</guid>
			<description><![CDATA[Rule 21.1 #define and #undef shall not be used on a reserved identifier or reserved macro name<br />
Rule 21.2 A reserved identifier or macro name shall not be declared<br />
<br />
" reserved macro name " or "macro name".<br />
<br />
Do you choose the usage of either?<br />
<br />
I expect a normalization of the words in the standard document.]]></description>
			<content:encoded><![CDATA[Rule 21.1 #define and #undef shall not be used on a reserved identifier or reserved macro name<br />
Rule 21.2 A reserved identifier or macro name shall not be declared<br />
<br />
" reserved macro name " or "macro name".<br />
<br />
Do you choose the usage of either?<br />
<br />
I expect a normalization of the words in the standard document.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Alternative to time.h]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1052</link>
			<pubDate>Wed, 23 Apr 2014 16:17:40 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=3294">gwillits</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1052</guid>
			<description><![CDATA[Rule 21.10 : The Standard Library time and date functions shall not be used.<br />
<br />
I'm relatively new to C, new to MISRA guidelines, and trying to wrap my head around how to substitute for the time.h library. I've internet-searched my brains out looking for some clue as to what people do for time functions. Do they completely re-implement their own code in order to avoid the "unspecified, undefined and implementation-defined behaviours" of the standard library?<br />
<br />
Given the expansion of Rationale of the 2012 over 2004 documentation, it surprised me there's no suggestions of what best practice alternatives are to the things which "shall not be used".<br />
<br />
Anyway, I'd appreciate anyone's input as to what MISRA conforming code does for time functionality.<br />
<br />
Many thanks,<br />
<br />
-- gw]]></description>
			<content:encoded><![CDATA[Rule 21.10 : The Standard Library time and date functions shall not be used.<br />
<br />
I'm relatively new to C, new to MISRA guidelines, and trying to wrap my head around how to substitute for the time.h library. I've internet-searched my brains out looking for some clue as to what people do for time functions. Do they completely re-implement their own code in order to avoid the "unspecified, undefined and implementation-defined behaviours" of the standard library?<br />
<br />
Given the expansion of Rationale of the 2012 over 2004 documentation, it surprised me there's no suggestions of what best practice alternatives are to the things which "shall not be used".<br />
<br />
Anyway, I'd appreciate anyone's input as to what MISRA conforming code does for time functionality.<br />
<br />
Many thanks,<br />
<br />
-- gw]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Definition of "declare" for Rule 21.2]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1051</link>
			<pubDate>Thu, 17 Apr 2014 04:22:33 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=2927">satoshi</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1051</guid>
			<description><![CDATA[Rule's title say "shall not be declared."<br />
<br />
C90/C99 use the "declare" for function declarations and variable declarations.<br />
And, macros are used the "define".<br />
<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>p.167<br />
#define __BUILTIN_sqrt(x) (x)   /* Non-compliant */</blockquote>
<br />
"example" is a rule violation for the macro definition.<br />
To error the macro definitions could not be a role of rule 21.1?<br />
<br />
<br />
-----<br />
Best regards,<br />
Satoshi Kawajiri]]></description>
			<content:encoded><![CDATA[Rule's title say "shall not be declared."<br />
<br />
C90/C99 use the "declare" for function declarations and variable declarations.<br />
And, macros are used the "define".<br />
<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>p.167<br />
#define __BUILTIN_sqrt(x) (x)   /* Non-compliant */</blockquote>
<br />
"example" is a rule violation for the macro definition.<br />
To error the macro definitions could not be a role of rule 21.1?<br />
<br />
<br />
-----<br />
Best regards,<br />
Satoshi Kawajiri]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[sample comment for Rule 21.1]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1050</link>
			<pubDate>Thu, 17 Apr 2014 03:06:24 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=2927">satoshi</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1050</guid>
			<description><![CDATA[In p.166, there are the following examples.<br />
<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>#define defined   /* Non-compliant - reserved identifier */</blockquote>
<br />
And, It is written as follows in the "amplification":<ul class="mycode_list"><li>Identifiers or macro names beginning with underscore.<br />
</li>
<li>Identifiers in file scope described in Section 7<br />
</li>
</ul>
<br />
I was thinking "the identifiers which is limited by this rule is<br />
 the identifiers(ex. memcpy, errno, ...) that defined in the library section of the C90/C99."<br />
<br />
If the rationale of the comment is the following statement, can I be considered that the normal reserved identifiers(ex. int, typedef, ...) are OK?<br />
Of course, although not preferred,  int or etc. are excluded as rule 21.1?<br />
<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>This rule prohibits the use of #define or #undef on th identifier <span style="font-style: italic;" class="mycode_i">defined </span> as ...</blockquote>
<br />
-----<br />
Best regards,<br />
Satoshi Kawajiri]]></description>
			<content:encoded><![CDATA[In p.166, there are the following examples.<br />
<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>#define defined   /* Non-compliant - reserved identifier */</blockquote>
<br />
And, It is written as follows in the "amplification":<ul class="mycode_list"><li>Identifiers or macro names beginning with underscore.<br />
</li>
<li>Identifiers in file scope described in Section 7<br />
</li>
</ul>
<br />
I was thinking "the identifiers which is limited by this rule is<br />
 the identifiers(ex. memcpy, errno, ...) that defined in the library section of the C90/C99."<br />
<br />
If the rationale of the comment is the following statement, can I be considered that the normal reserved identifiers(ex. int, typedef, ...) are OK?<br />
Of course, although not preferred,  int or etc. are excluded as rule 21.1?<br />
<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>This rule prohibits the use of #define or #undef on th identifier <span style="font-style: italic;" class="mycode_i">defined </span> as ...</blockquote>
<br />
-----<br />
Best regards,<br />
Satoshi Kawajiri]]></content:encoded>
		</item>
	</channel>
</rss>