{"id":18493,"date":"2009-04-22T10:00:00","date_gmt":"2009-04-22T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2009\/04\/22\/what-structure-packing-do-the-windows-sdk-header-files-expect\/"},"modified":"2009-04-22T10:00:00","modified_gmt":"2009-04-22T10:00:00","slug":"what-structure-packing-do-the-windows-sdk-header-files-expect","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20090422-00\/?p=18493","title":{"rendered":"What structure packing do the Windows SDK header files expect?"},"content":{"rendered":"<p> \/Zp8 <\/p>\n<p> In words, integral types and pointers up to eight bytes in size are stored at their natural alignment. Larger types are stored at eight-byte alignment. <\/p>\n<table>\n<tr>\n<th>Type<\/th>\n<th>Alignment<\/th>\n<\/tr>\n<tr>\n<td><code>BYTE<\/code>, <code>char<\/code>, <code>UCHAR<\/code><\/td>\n<td>1-byte alignment<\/td>\n<\/tr>\n<tr>\n<td><code>WORD<\/code>, <code>WCHAR<\/code>, <code>short<\/code>,     <code>USHORT<\/code><\/td>\n<td>2-byte alignment<\/td>\n<\/tr>\n<tr>\n<td><code>DWORD<\/code>, <code>int<\/code>, <code>long<\/code>,     <code>UINT<\/code>, <code>ULONG<\/code>, <code>float<\/code>,     32-bit pointer<\/td>\n<td>4-byte alignment<\/td>\n<\/tr>\n<tr>\n<td><code>QWORD<\/code>, <code>__int64<\/code>,     <code>unsigned __int64<\/code>, <code>double<\/code>, 64-bit pointer<\/td>\n<td>8-byte alignment<\/td>\n<\/tr>\n<\/table>\n<p> In other words (saying it a third time), let <code>T<\/code> be an integral or pointer type. If <code>sizeof(T)<\/code> &le; 8, then <code>T<\/code> is aligned at a <code>sizeof(T)<\/code>-byte boundary. If <code>sizeof(T)<\/code> &ge; 8, then <code>T<\/code> is aligned at an 8-byte boundary. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/Zp8 In words, integral types and pointers up to eight bytes in size are stored at their natural alignment. Larger types are stored at eight-byte alignment. Type Alignment BYTE, char, UCHAR 1-byte alignment WORD, WCHAR, short, USHORT 2-byte alignment DWORD, int, long, UINT, ULONG, float, 32-bit pointer 4-byte alignment QWORD, __int64, unsigned __int64, double, 64-bit [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-18493","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>\/Zp8 In words, integral types and pointers up to eight bytes in size are stored at their natural alignment. Larger types are stored at eight-byte alignment. Type Alignment BYTE, char, UCHAR 1-byte alignment WORD, WCHAR, short, USHORT 2-byte alignment DWORD, int, long, UINT, ULONG, float, 32-bit pointer 4-byte alignment QWORD, __int64, unsigned __int64, double, 64-bit [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/18493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=18493"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/18493\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=18493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=18493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=18493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}