<?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.16 Functions]]></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:01 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Is 16.4 violated if 16.3 is?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=918</link>
			<pubDate>Thu, 11 Oct 2012 20:23:29 +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=918</guid>
			<description><![CDATA[Given the following code:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>void f(int);<br />
void f(int x){}</code></div></div>Does this code violate rule #16.4, identifiers used in the declaration and definition of a function shall be identical? While the lack of a parameter name in the prototype violates #16.3, I am not sure if violating #16.4 is possible in that case.]]></description>
			<content:encoded><![CDATA[Given the following code:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>void f(int);<br />
void f(int x){}</code></div></div>Does this code violate rule #16.4, identifiers used in the declaration and definition of a function shall be identical? While the lack of a parameter name in the prototype violates #16.3, I am not sure if violating #16.4 is possible in that case.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[16.9 Reference to function pointer or not]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=903</link>
			<pubDate>Tue, 05 Jun 2012 07:55:04 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=2098">hele</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=903</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>typedef void (*fp)(STATE_MACHINE *sm, EVENT input);<br />
struct STATE_MACHINE_<br />
{<br />
&nbsp;&nbsp;fp fp_cur_state;<br />
};<br />
<br />
void stm_Startup&nbsp;&nbsp; (STATE_MACHINE *sm,&nbsp;&nbsp;EVENT input);</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>STM_STATE_MACHINE *sm;<br />
sm-&gt;fp_cur_state = &amp;stm_Startup;</code></div></div>or<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>sm-&gt;fp_cur_state = stm_Startup;</code></div></div>??<br />
<br />
I have two tools to check code for Misra C.<br />
Checking version<span style="font-weight: bold;" class="mycode_b"> without &amp;</span> to the function pointer with Tastking I get the error:<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>MISRA-C rule 16.9 violation: [R] function calls with no parameters should have empty parentheses</blockquote>
What in fact means the exact rule (I guess):<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>MISRA-C rule 16.9 violation: [R] A function identifier shall only be used with either a preceding &amp;, or with a parenthesised parameter list, which may be empty.</blockquote>
<br />
checking with PC-Lint <span style="font-weight: bold;" class="mycode_b"> with &amp;</span> I get<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>sm-&gt;fp_cur_state = &amp;stm_Startup;								<br />
stateMachine.c  72  Warning 546: Suspicious use of &amp;</blockquote>
<br />
What's right? I guess functionality should be the same in both cases.]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>typedef void (*fp)(STATE_MACHINE *sm, EVENT input);<br />
struct STATE_MACHINE_<br />
{<br />
&nbsp;&nbsp;fp fp_cur_state;<br />
};<br />
<br />
void stm_Startup&nbsp;&nbsp; (STATE_MACHINE *sm,&nbsp;&nbsp;EVENT input);</code></div></div><div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>STM_STATE_MACHINE *sm;<br />
sm-&gt;fp_cur_state = &amp;stm_Startup;</code></div></div>or<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>sm-&gt;fp_cur_state = stm_Startup;</code></div></div>??<br />
<br />
I have two tools to check code for Misra C.<br />
Checking version<span style="font-weight: bold;" class="mycode_b"> without &amp;</span> to the function pointer with Tastking I get the error:<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>MISRA-C rule 16.9 violation: [R] function calls with no parameters should have empty parentheses</blockquote>
What in fact means the exact rule (I guess):<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>MISRA-C rule 16.9 violation: [R] A function identifier shall only be used with either a preceding &amp;, or with a parenthesised parameter list, which may be empty.</blockquote>
<br />
checking with PC-Lint <span style="font-weight: bold;" class="mycode_b"> with &amp;</span> I get<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>sm-&gt;fp_cur_state = &amp;stm_Startup;								<br />
stateMachine.c  72  Warning 546: Suspicious use of &amp;</blockquote>
<br />
What's right? I guess functionality should be the same in both cases.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 16.8 and 14.7]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=871</link>
			<pubDate>Fri, 06 Jan 2012 22:35:03 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=1894">jpmzometa</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=871</guid>
			<description><![CDATA[In rule 16.8 is stated<br />
<span style="font-weight: bold;" class="mycode_b">All</span> exit paths from a function...<br />
whereas rule 14.7 states<br />
A function shall have a <span style="font-weight: bold;" class="mycode_b">single</span> point of exit...<br />
<br />
Is there a difference between "exit path" and "point of exit"? If not, should rule 16.8 be interpreted as beginning with "The single point of exit from a function..."?<br />
<br />
Regards,]]></description>
			<content:encoded><![CDATA[In rule 16.8 is stated<br />
<span style="font-weight: bold;" class="mycode_b">All</span> exit paths from a function...<br />
whereas rule 14.7 states<br />
A function shall have a <span style="font-weight: bold;" class="mycode_b">single</span> point of exit...<br />
<br />
Is there a difference between "exit path" and "point of exit"? If not, should rule 16.8 be interpreted as beginning with "The single point of exit from a function..."?<br />
<br />
Regards,]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 16.7]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=844</link>
			<pubDate>Mon, 12 Sep 2011 16:54:11 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=1742">misterb</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=844</guid>
			<description><![CDATA[Hello,<br />
<br />
please look at the following code snippet:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>struct testStruct {<br />
&nbsp;&nbsp;float32_t varFlt3[3][16];<br />
};<br />
<br />
static void f1(struct testStruct * const testStructData);<br />
static void f2(float32_t in_Data[3][16]);<br />
<br />
static void f1(struct testStruct * const testStructData)<br />
{<br />
&nbsp;&nbsp;f2(testStructData-&gt;varFlt3);<br />
}<br />
<br />
static void f2(float32_t in_Data[3][16])<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;uint32_t i = 0u;<br />
&nbsp;&nbsp;&nbsp;&nbsp;for(i = 0u; i &lt; 16u; i++)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in_Data[0][i] = (float32_t)i;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}<br />
<br />
int32_t main(void)<br />
{<br />
&nbsp;&nbsp;/* This struct should be modified */<br />
&nbsp;&nbsp;static struct testStruct test;<br />
&nbsp;&nbsp;&nbsp;&nbsp;f1(&amp;test);<br />
&nbsp;&nbsp;&nbsp;&nbsp;return 0;<br />
}</code></div></div><br />
My compiler returns a MISRA C rule 16.7 checker error because f1() shall point to a const object. In my opinion, it can't be const, because, the object is modified by f2() inside f1(). The compiler can know this. So who is correct? The compiler vendor or me? If the compiler is correct, how can I overcome this problem? If I modify the parameter of f1() to const I'll get an error because f2() modifies the object, the pointer parameter points to.<br />
<br />
Kind regards,<br />
<br />
Michael]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
please look at the following code snippet:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>struct testStruct {<br />
&nbsp;&nbsp;float32_t varFlt3[3][16];<br />
};<br />
<br />
static void f1(struct testStruct * const testStructData);<br />
static void f2(float32_t in_Data[3][16]);<br />
<br />
static void f1(struct testStruct * const testStructData)<br />
{<br />
&nbsp;&nbsp;f2(testStructData-&gt;varFlt3);<br />
}<br />
<br />
static void f2(float32_t in_Data[3][16])<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;uint32_t i = 0u;<br />
&nbsp;&nbsp;&nbsp;&nbsp;for(i = 0u; i &lt; 16u; i++)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in_Data[0][i] = (float32_t)i;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}<br />
<br />
int32_t main(void)<br />
{<br />
&nbsp;&nbsp;/* This struct should be modified */<br />
&nbsp;&nbsp;static struct testStruct test;<br />
&nbsp;&nbsp;&nbsp;&nbsp;f1(&amp;test);<br />
&nbsp;&nbsp;&nbsp;&nbsp;return 0;<br />
}</code></div></div><br />
My compiler returns a MISRA C rule 16.7 checker error because f1() shall point to a const object. In my opinion, it can't be const, because, the object is modified by f2() inside f1(). The compiler can know this. So who is correct? The compiler vendor or me? If the compiler is correct, how can I overcome this problem? If I modify the parameter of f1() to const I'll get an error because f2() modifies the object, the pointer parameter points to.<br />
<br />
Kind regards,<br />
<br />
Michael]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 16.9]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=841</link>
			<pubDate>Fri, 26 Aug 2011 20:40:01 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=606">roberto</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=841</guid>
			<description><![CDATA[Please consider the following snippet:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>static int foo1(void) {<br />
&nbsp;&nbsp;return 0;<br />
}<br />
<br />
static int foo2(void) {<br />
&nbsp;&nbsp;return 1;<br />
}<br />
<br />
int foo() {<br />
&nbsp;&nbsp;/* Is the following occurrence of `foo1' compliant wrt 16.9? */<br />
&nbsp;&nbsp;if (&amp;(foo1) == &amp;foo2)<br />
&nbsp;&nbsp;&nbsp;&nbsp;return 0;<br />
&nbsp;&nbsp;return 1;<br />
}</code></div></div>]]></description>
			<content:encoded><![CDATA[Please consider the following snippet:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>static int foo1(void) {<br />
&nbsp;&nbsp;return 0;<br />
}<br />
<br />
static int foo2(void) {<br />
&nbsp;&nbsp;return 1;<br />
}<br />
<br />
int foo() {<br />
&nbsp;&nbsp;/* Is the following occurrence of `foo1' compliant wrt 16.9? */<br />
&nbsp;&nbsp;if (&amp;(foo1) == &amp;foo2)<br />
&nbsp;&nbsp;&nbsp;&nbsp;return 0;<br />
&nbsp;&nbsp;return 1;<br />
}</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 16.5]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=838</link>
			<pubDate>Tue, 02 Aug 2011 12:11:26 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=868">hanthen</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=838</guid>
			<description><![CDATA[Does this rule apply also to function pointers?<br />
If I want to declare a function pointer which can be used for pointers to functions with different arguments, something like the following is useful:<br />
<br />
uint8_t (* gen_u8p)();<br />
<br />
Is this intended to be prohibited by the rule?]]></description>
			<content:encoded><![CDATA[Does this rule apply also to function pointers?<br />
If I want to declare a function pointer which can be used for pointers to functions with different arguments, something like the following is useful:<br />
<br />
uint8_t (* gen_u8p)();<br />
<br />
Is this intended to be prohibited by the rule?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[16.3]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=824</link>
			<pubDate>Fri, 15 Apr 2011 12:52:55 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=944">beckschulze</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=824</guid>
			<description><![CDATA[Just to make sure, does rule 16.3 also apply to declarations of function pointers?<br />
<br />
void (*pt2Function)(int);<br />
<br />
Sould I give a name to the parameter?<br />
Does that make sense at all?]]></description>
			<content:encoded><![CDATA[Just to make sure, does rule 16.3 also apply to declarations of function pointers?<br />
<br />
void (*pt2Function)(int);<br />
<br />
Sould I give a name to the parameter?<br />
Does that make sense at all?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 16.9 - Error in code example]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=683</link>
			<pubDate>Sat, 24 Oct 2009 16:18:56 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=745">William Forbes</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=683</guid>
			<description><![CDATA[The code in the normative text of rule 16.9 is:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if (f)&nbsp;&nbsp;&nbsp;&nbsp; /* not compliant - gives a constant non-zero value which is<br />
{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the address of f - use either f() or &amp;f */<br />
&nbsp;&nbsp;&nbsp;&nbsp;/* ... */<br />
}</code></div></div>Maybe it should be:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if (f)&nbsp;&nbsp;&nbsp;&nbsp; /* not compliant - gives a constant non-zero value which is<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the address of f - use either f() or &amp;f */<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;/* ... */<br />
}</code></div></div><br />
Note - the opening brace was inside the comment.<br />
A trivial error but maybe it should get corrected?]]></description>
			<content:encoded><![CDATA[The code in the normative text of rule 16.9 is:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if (f)&nbsp;&nbsp;&nbsp;&nbsp; /* not compliant - gives a constant non-zero value which is<br />
{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the address of f - use either f() or &amp;f */<br />
&nbsp;&nbsp;&nbsp;&nbsp;/* ... */<br />
}</code></div></div>Maybe it should be:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>if (f)&nbsp;&nbsp;&nbsp;&nbsp; /* not compliant - gives a constant non-zero value which is<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the address of f - use either f() or &amp;f */<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;/* ... */<br />
}</code></div></div><br />
Note - the opening brace was inside the comment.<br />
A trivial error but maybe it should get corrected?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 16.4]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=450</link>
			<pubDate>Mon, 04 Feb 2008 14:22:36 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=436">Lundin</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=450</guid>
			<description><![CDATA[I wonder if rule 16.4 fills a purpose, as it seems to be well-covered by several other MISRA rules.<br />
<br />
\"16.4 The identifiers used in the declaration and definition of a function shall be identical.\"<br />
<br />
\"8.3 For each function parameter the type given in the declaration and definition shall be identical, and the return types shall also be identical.\"<br />
<br />
8.3 has both the parameters and the return type covered, all is fine there. Therefore I assume that rule 16.4 only applies to the function name itself. Ie it would be interpreted as \"the function identifier used in declaration and definition shall be identical\". <br />
<br />
So as far as I understand it, rule 16.4 would only apply when the names in the function definition and the declaration are different, ie the scenario where the function definition is \"apples\" but the function declaration is \"bananas\" (although their parameters and return types are identical, as covered by rule 8.3):<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>static void apples&nbsp;&nbsp;(uint8_t n);<br />
<br />
static void bananas (uint8_t n)<br />
{<br />
<br />
}<br />
<br />
int main()<br />
{<br />
&nbsp;&nbsp;apples(x);&nbsp;&nbsp;/* A linker error will occur, apples() isn't found and the program won't be executed. */<br />
<br />
&nbsp;&nbsp;bananas(x); /* This will work fine but the prototype &#92;"apples&#92;" is redundant. */<br />
}</code></div></div><br />
The above behavior is the same if the function definition is placed in a h-file and the function is called from another file.<br />
<br />
The \"bananas\" case will never result in faulty program behavior, assuming rule 8.3 is fulfilled. Also, this case would violate rule 8.1 \"Functions shall have a prototype...\". And if the bananas function had been placed below main() instead of above, the code wouldn't even compile.<br />
<br />
So I fail to see the point of rule 16.4, it seems redundant to me.]]></description>
			<content:encoded><![CDATA[I wonder if rule 16.4 fills a purpose, as it seems to be well-covered by several other MISRA rules.<br />
<br />
\"16.4 The identifiers used in the declaration and definition of a function shall be identical.\"<br />
<br />
\"8.3 For each function parameter the type given in the declaration and definition shall be identical, and the return types shall also be identical.\"<br />
<br />
8.3 has both the parameters and the return type covered, all is fine there. Therefore I assume that rule 16.4 only applies to the function name itself. Ie it would be interpreted as \"the function identifier used in declaration and definition shall be identical\". <br />
<br />
So as far as I understand it, rule 16.4 would only apply when the names in the function definition and the declaration are different, ie the scenario where the function definition is \"apples\" but the function declaration is \"bananas\" (although their parameters and return types are identical, as covered by rule 8.3):<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>static void apples&nbsp;&nbsp;(uint8_t n);<br />
<br />
static void bananas (uint8_t n)<br />
{<br />
<br />
}<br />
<br />
int main()<br />
{<br />
&nbsp;&nbsp;apples(x);&nbsp;&nbsp;/* A linker error will occur, apples() isn't found and the program won't be executed. */<br />
<br />
&nbsp;&nbsp;bananas(x); /* This will work fine but the prototype &#92;"apples&#92;" is redundant. */<br />
}</code></div></div><br />
The above behavior is the same if the function definition is placed in a h-file and the function is called from another file.<br />
<br />
The \"bananas\" case will never result in faulty program behavior, assuming rule 8.3 is fulfilled. Also, this case would violate rule 8.1 \"Functions shall have a prototype...\". And if the bananas function had been placed below main() instead of above, the code wouldn't even compile.<br />
<br />
So I fail to see the point of rule 16.4, it seems redundant to me.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 104 question on function pointers]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=27</link>
			<pubDate>Thu, 03 Mar 2005 21:40:06 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=83">foobarista</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=27</guid>
			<description><![CDATA[Our product makes use of a \"service-based\" architecture - and, while it is \"good code\" that runs on 16, 32, and 64 bit environments, it wasn't initially written with MISRA compliance in mind, although we're \"pretty close\".  The tricky one is Rule 104...<br />
<br />
Anyway, since networking, IPC, and other typical PC-and-up options for doing services aren't often available in constrained embedded environments, we've chosen function pointers and a \"registration\" methodology as our approach.  We're an ISV that works with customers who typically write services themselves or use one of several service implementations that we provide.  Services are things like file-system API interfaces, flash I/O interfaces, memory management, etc.<br />
<br />
So, I have a question about Rule 104: it would seem that Rule 104 disallows this sort of approach, if I read it right: services are ultimately dynamically-created structures that contain arrays of function pointers that execute the different operations of the service.<br />
<br />
The only \"get out of jail free\" card that I can see is that these pointers are set only once at registration time and not changed while the instance of the service exists.  But the function pointers are initialized at runtime, so it would seem that we're still in violation of Rule 104.<br />
<br />
Is \"initialized at runtime\" versus \"initialized at compile-time\" the test for Rule 104 compliance?  Or is it \"a function pointer that is changed\", versus one that is initialized once, whether at compile or runtime, and not changed afterward?]]></description>
			<content:encoded><![CDATA[Our product makes use of a \"service-based\" architecture - and, while it is \"good code\" that runs on 16, 32, and 64 bit environments, it wasn't initially written with MISRA compliance in mind, although we're \"pretty close\".  The tricky one is Rule 104...<br />
<br />
Anyway, since networking, IPC, and other typical PC-and-up options for doing services aren't often available in constrained embedded environments, we've chosen function pointers and a \"registration\" methodology as our approach.  We're an ISV that works with customers who typically write services themselves or use one of several service implementations that we provide.  Services are things like file-system API interfaces, flash I/O interfaces, memory management, etc.<br />
<br />
So, I have a question about Rule 104: it would seem that Rule 104 disallows this sort of approach, if I read it right: services are ultimately dynamically-created structures that contain arrays of function pointers that execute the different operations of the service.<br />
<br />
The only \"get out of jail free\" card that I can see is that these pointers are set only once at registration time and not changed while the instance of the service exists.  But the function pointers are initialized at runtime, so it would seem that we're still in violation of Rule 104.<br />
<br />
Is \"initialized at runtime\" versus \"initialized at compile-time\" the test for Rule 104 compliance?  Or is it \"a function pointer that is changed\", versus one that is initialized once, whether at compile or runtime, and not changed afterward?]]></content:encoded>
		</item>
	</channel>
</rss>