<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Keil structure padding</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/32705/keil-structure-padding</link><description>Hello, 
 I am using the nRF52840 DK with Keil to develop. I have a structure defined as follows: 
 
 I have verified that uint8 is 1 byte, uint16 is 2 bytes, and uint32 is 4 bytes. The size of struct multipart_header should be 16 bytes but it reports</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 23 Mar 2018 15:55:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/32705/keil-structure-padding" /><item><title>RE: Keil structure padding</title><link>https://devzone.nordicsemi.com/thread/125789?ContentTypeID=1</link><pubDate>Fri, 23 Mar 2018 15:55:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1befbcc-8bd4-43fe-a12d-98b740791a4d</guid><dc:creator>Turbo J</dc:creator><description>[quote userid="7768" url="~/f/nordic-q-a/32705/keil-structure-padding"]Is Keil padding this structure to a 32-bit boundary?[/quote]
&lt;p&gt;Yes, and you usually want that even on a Cortex-M4F for performance reasons.&lt;/p&gt;
&lt;p&gt;One might be tempted to use &amp;quot;packed&amp;quot; struct (see compiler documentation), but in some cases you also need to fiddle with endian conversions, which means custom (de-)serialisation code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>