<?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.2 Language Extensions]]></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:22 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Packed struct]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=854</link>
			<pubDate>Thu, 29 Sep 2011 10:27:55 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=662">jimhuf</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=854</guid>
			<description><![CDATA[Hi <br />
is packing of structures allowed within Misra C? <br />
<br />
I only wish to use the structure to overlay a generic byte array, which is populated from an external interface serialy. However the structure has 7 bytes but without packing has 8. <br />
<br />
What i want is to be able to index into the generic array as such <br />
 <br />
sCFG  *ptr = &amp;genericArray[0];<br />
<br />
for(i=0u; i&lt; 10u; i++){<br />
       ptr[i].CFG0 = 10u;<br />
       ..etc..<br />
}<br />
<br />
But because without packing the struct is 1 byte larger, i will end up misaligned. <br />
So basically can i pack my structure to acheive this goal?<br />
<br />
Thank you <br />
<br />
James<br />
<br />
FYI <br />
typedef struct{<br />
	u8 CFG0;	<br />
	u8 CFG1;<br />
	u8 CFG2;<br />
	u8 CFG3;<br />
	u8 CFG4;<br />
	u8 CFG5;<br />
	u8 CFG6;		<br />
}sCFG ;]]></description>
			<content:encoded><![CDATA[Hi <br />
is packing of structures allowed within Misra C? <br />
<br />
I only wish to use the structure to overlay a generic byte array, which is populated from an external interface serialy. However the structure has 7 bytes but without packing has 8. <br />
<br />
What i want is to be able to index into the generic array as such <br />
 <br />
sCFG  *ptr = &amp;genericArray[0];<br />
<br />
for(i=0u; i&lt; 10u; i++){<br />
       ptr[i].CFG0 = 10u;<br />
       ..etc..<br />
}<br />
<br />
But because without packing the struct is 1 byte larger, i will end up misaligned. <br />
So basically can i pack my structure to acheive this goal?<br />
<br />
Thank you <br />
<br />
James<br />
<br />
FYI <br />
typedef struct{<br />
	u8 CFG0;	<br />
	u8 CFG1;<br />
	u8 CFG2;<br />
	u8 CFG3;<br />
	u8 CFG4;<br />
	u8 CFG5;<br />
	u8 CFG6;		<br />
}sCFG ;]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Assembly encapsulation in macros?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=730</link>
			<pubDate>Mon, 26 Apr 2010 18:41:36 +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=730</guid>
			<description><![CDATA[Is this code compliant with rule #2.1?<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#define ASM_MACRO_1 asm { "abc" }<br />
#define ASM_MACRO_2 asm { "xyz" }<br />
<br />
extern void g();<br />
<br />
void f( void )<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;ASM_MACRO_1;&nbsp;&nbsp;&nbsp;&nbsp;/* Do something in assembly.&nbsp;&nbsp;&nbsp;&nbsp;*/<br />
&nbsp;&nbsp;&nbsp;&nbsp;g();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Do something in C.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br />
&nbsp;&nbsp;&nbsp;&nbsp;ASM_MACRO_2;&nbsp;&nbsp;&nbsp;&nbsp;/* Do something in assembly.&nbsp;&nbsp;&nbsp;&nbsp;*/<br />
&nbsp;&nbsp;&nbsp;&nbsp;}</code></div></div>]]></description>
			<content:encoded><![CDATA[Is this code compliant with rule #2.1?<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#define ASM_MACRO_1 asm { "abc" }<br />
#define ASM_MACRO_2 asm { "xyz" }<br />
<br />
extern void g();<br />
<br />
void f( void )<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;ASM_MACRO_1;&nbsp;&nbsp;&nbsp;&nbsp;/* Do something in assembly.&nbsp;&nbsp;&nbsp;&nbsp;*/<br />
&nbsp;&nbsp;&nbsp;&nbsp;g();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Do something in C.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br />
&nbsp;&nbsp;&nbsp;&nbsp;ASM_MACRO_2;&nbsp;&nbsp;&nbsp;&nbsp;/* Do something in assembly.&nbsp;&nbsp;&nbsp;&nbsp;*/<br />
&nbsp;&nbsp;&nbsp;&nbsp;}</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Silencing the checker]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=621</link>
			<pubDate>Sun, 08 Feb 2009 08:35:07 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=286">JonM</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=621</guid>
			<description><![CDATA[What do people think of comments like these in code<br />
<br />
/* defines to satisfy the MISRA checker tool */<br />
... inevitable strange pre-processor magic<br />
<br />
<br />
#if defined ( MISRA_CHECK )<br />
  .. behaviour 1<br />
#endif<br />
<br />
I see worrying amounts of it in a project I am working with and it makes me think I am working with unfinished code where the developers would rather continue writing insecure code by keeping a checker quiet than addressing the root causes. That this has been allowed by the checking tool vendor without<br />
<br />
Does this kind of thing satisfy the spirit of MISRA and should checking tool vendors be inventing their own suppression language to litter the C-code with?<br />
<br />
Does it break rule 2.4 - sections of code should not be commented out<br />
<br />
Could we have a rule that bans checking tool logic, defines and comments in production code. Could we add a rule that requires checking tool vendors be required to discard the content of all well formed comments and not add mechansims for the programmer to determine if a checking tool is parsing the code? please.<br />
<br />
Jonathan]]></description>
			<content:encoded><![CDATA[What do people think of comments like these in code<br />
<br />
/* defines to satisfy the MISRA checker tool */<br />
... inevitable strange pre-processor magic<br />
<br />
<br />
#if defined ( MISRA_CHECK )<br />
  .. behaviour 1<br />
#endif<br />
<br />
I see worrying amounts of it in a project I am working with and it makes me think I am working with unfinished code where the developers would rather continue writing insecure code by keeping a checker quiet than addressing the root causes. That this has been allowed by the checking tool vendor without<br />
<br />
Does this kind of thing satisfy the spirit of MISRA and should checking tool vendors be inventing their own suppression language to litter the C-code with?<br />
<br />
Does it break rule 2.4 - sections of code should not be commented out<br />
<br />
Could we have a rule that bans checking tool logic, defines and comments in production code. Could we add a rule that requires checking tool vendors be required to discard the content of all well formed comments and not add mechansims for the programmer to determine if a checking tool is parsing the code? please.<br />
<br />
Jonathan]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Rule 2.1]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=217</link>
			<pubDate>Thu, 16 Feb 2006 07:22:58 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=206">nikunj</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=217</guid>
			<description><![CDATA[What are the possible scenarios in which Rule 2.1 will be violated?<br />
<br />
Rule allows for Macros, C-functions and Assembly functions.<br />
<br />
If any assembly code is used directly it will be reported as an compliler error for undefined identifier etc.]]></description>
			<content:encoded><![CDATA[What are the possible scenarios in which Rule 2.1 will be violated?<br />
<br />
Rule allows for Macros, C-functions and Assembly functions.<br />
<br />
If any assembly code is used directly it will be reported as an compliler error for undefined identifier etc.]]></content:encoded>
		</item>
	</channel>
</rss>