{"id":11993,"date":"2010-12-16T07:00:00","date_gmt":"2010-12-16T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2010\/12\/16\/why-does-shcolumninfo-have-unusually-tight-packing\/"},"modified":"2010-12-16T07:00:00","modified_gmt":"2010-12-16T07:00:00","slug":"why-does-shcolumninfo-have-unusually-tight-packing","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20101216-00\/?p=11993","title":{"rendered":"Why does SHCOLUMNINFO have unusually tight packing?"},"content":{"rendered":"<p>\nAlternate title:\n<i>News flash: Sometimes things happen by mistake<\/i>\n<\/p>\n<p>\nrbirkby asks\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2007\/12\/27\/6873648.aspx#6880004\">\nwhy the <code>SHCOLUMNINFO<\/code> structure has 1-byte packing<\/a>.\n&#8220;Was the expectation that there would be so many columns\nin a details view that the saving would be worthwhile?&#8221;\n<\/p>\n<p>\nHardly anything that clever or ingenious. It&#8217;s just the consequence of\na mistake.\n<\/p>\n<p>\nWhen the <code>SHCOLUMNINFO<\/code> structure was added to the\nheader file in the Windows&nbsp;2000 timeframe,\nit was added with no specific packing directive.\nBut it turns out that there <i>was<\/i> a specific packing directive;\nit just wasn&#8217;t obvious.\nNear the top of the <code>shlobj.h<\/code> header file was the following:\n<\/p>\n<pre>\n#include &lt;pshpack1.h&gt;   \/* Assume byte packing throughout *\/\n<\/pre>\n<p>\n(There was of course a matching <code>#include &lt;poppack.h&gt;<\/code>\nat the bottom.)\nThis set the default packing for the entire header file to byte\npacking instead of natural alignment.\n<\/p>\n<p>\nBy the time this mistake was identified, it was too late.\nWindows&nbsp;2000 had already shipped, byte packing and all.\nAnd once the code ships,\nit&#8217;s done.\nYou&#8217;re stuck with it.\n<\/p>\n<p>\nSorry.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Alternate title: News flash: Sometimes things happen by mistake rbirkby asks why the SHCOLUMNINFO structure has 1-byte packing. &#8220;Was the expectation that there would be so many columns in a details view that the saving would be worthwhile?&#8221; Hardly anything that clever or ingenious. It&#8217;s just the consequence of a mistake. When the SHCOLUMNINFO structure [&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-11993","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Alternate title: News flash: Sometimes things happen by mistake rbirkby asks why the SHCOLUMNINFO structure has 1-byte packing. &#8220;Was the expectation that there would be so many columns in a details view that the saving would be worthwhile?&#8221; Hardly anything that clever or ingenious. It&#8217;s just the consequence of a mistake. When the SHCOLUMNINFO structure [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/11993","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=11993"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/11993\/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=11993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=11993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=11993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}