<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/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/"><channel><title>The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx</link><description>The classic 32-bit dialog template.</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#161444</link><pubDate>Mon, 21 Jun 2004 15:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:161444</guid><dc:creator>Frederik Slijkerman</dc:creator><description>What's the reason to pad fields in structures like this to DWORD boundaries? This is always a lot more work to program for -- and test the special cases that require padding. It's especially irritating with DIB scan lines.&lt;br&gt;&lt;br&gt;The only reason I can think of is that it is marginally faster. Sounds like a good example of premature optimization, or am I mistaken?</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#161451</link><pubDate>Mon, 21 Jun 2004 15:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:161451</guid><dc:creator>Raymond Chen</dc:creator><description>It's not an optimization. It's a necessity.&lt;br&gt;&lt;br&gt;The overwhelming dominance of the x86 architecture in the world of Win32 makes people think that the way the x86 does things is normal, when in reality the x86 is the weirdo.&lt;br&gt;&lt;br&gt;PPC, MIPS, Alpha AXP, ia64 all crash if you access unaligned data. x86 is the weirdo: It permits unaligned data access.&lt;br&gt;</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#161454</link><pubDate>Mon, 21 Jun 2004 15:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:161454</guid><dc:creator>Cooney</dc:creator><description>It could be a remnant of the Alpha/MIPS NT effort - accessing unaligned data caused a segfault instead of simply being slow. Alternate theory: the structs used to hold this data are compiled with dword alignment and loaded directly from a file, so unaligned data is misinterpreted.</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#161633</link><pubDate>Mon, 21 Jun 2004 19:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:161633</guid><dc:creator>JamKnight</dc:creator><description>I don't understand why you would even want to have unaligned data access. In my opinion it only makes things more complicated.&lt;br&gt;&lt;br&gt;Can anyone point to a case where it is better/cleaner than using aligned?</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#161713</link><pubDate>Mon, 21 Jun 2004 20:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:161713</guid><dc:creator>Cooney</dc:creator><description>If space is really tight, as it was way back when, then every byte counts. Otherwise, go right a head and align your data - I do.</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#161762</link><pubDate>Mon, 21 Jun 2004 21:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:161762</guid><dc:creator>asdf</dc:creator><description>It makes your code cleaner if you don't have to worry about unaligned stuff. For the most part this is transparent to you but there are some areas where it isn't. You pay for unaligned memory access in higher cycle counts, not having atomic operations, and segfaults in non x86 processors. Win64 supports bad code with SetErrorMode(SEM_NOALIGNMENTFAULTEXCEPT) or the __unaligned qualifier (how thoughtful of them).&lt;br&gt;</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#161805</link><pubDate>Mon, 21 Jun 2004 22:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:161805</guid><dc:creator>Simon Cooke [exMSFT]</dc:creator><description>JamKnight:&lt;br&gt;&lt;br&gt;Unaligned is better than aligned when you're dealing with different CPUs that have different alignment requirements from the get go.&lt;br&gt;&lt;br&gt;(eg. a CPU that required 16bit alignment vs. one that requires 64bit alignment... but you design everything before the 64bit one is on the horizon).&lt;br&gt;&lt;br&gt;But yeah, it's a real edge case.</description></item><item><title>The evolution of dialog templates - 32-bit Classic Templates (from: Raymond Chen)</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#161889</link><pubDate>Tue, 22 Jun 2004 03:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:161889</guid><dc:creator>Test .Text Blog</dc:creator><description /></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#161946</link><pubDate>Tue, 22 Jun 2004 01:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:161946</guid><dc:creator>doynax</dc:creator><description>&amp;gt; (eg. a CPU that required 16bit alignment vs. one that requires 64bit alignment... but you design everything before the 64bit one is on the horizon).&lt;br&gt;This doesn't have to be a problem, just align everything according to the largest datatype.</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#162071</link><pubDate>Tue, 22 Jun 2004 05:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:162071</guid><dc:creator>Waleri</dc:creator><description>Unfortunatly, one cannot use control's text ordinal to display text - it works for icon and bitmaps only. pity</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#162128</link><pubDate>Tue, 22 Jun 2004 06:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:162128</guid><dc:creator>asdf</dc:creator><description>Raymond: the x, y, cx, cy fields should be signed and there is no 0xFF 0x00 to specify ordinals, it's all 0xFFFF.&lt;br&gt;</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#162136</link><pubDate>Tue, 22 Jun 2004 07:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:162136</guid><dc:creator>Holger Dors</dc:creator><description>You write &amp;quot;strings got changed from ANSI to Unicode&amp;quot;: what kind of encoding is used for Unicode? Is it UCS-2 or UTF-16? &lt;br&gt;&lt;br&gt;I never have been able to find the answer on this...</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#162193</link><pubDate>Tue, 22 Jun 2004 09:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:162193</guid><dc:creator>Frederik Slijkerman</dc:creator><description>For example, with 24-bit DIBs it is a pain in the behind because you can't write&lt;br&gt;&lt;br&gt;lpPixel = lpData + 3 * (x + y * width);&lt;br&gt;&lt;br&gt;but the tedious:&lt;br&gt;&lt;br&gt;byteWidth = (width * 3 + 3) &amp;amp; 0xFFFFFFFC;&lt;br&gt;lpPixel = lpData + 3 * x + y * byteWidth;&lt;br&gt;</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#162389</link><pubDate>Tue, 22 Jun 2004 14:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:162389</guid><dc:creator>Raymond Chen</dc:creator><description>Holger: What's the difference between UCS-2 and UTF-16? As far as I can tell they both use surrogate pairs.</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#162419</link><pubDate>Tue, 22 Jun 2004 14:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:162419</guid><dc:creator>Holger Dors</dc:creator><description>@Raymond: no, UCS-2 cannot use surrogate pairs and is limit to codepoints up tp $FFFF. AFAIK that was the reason why UTF-16 was created in the first place.</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#162431</link><pubDate>Tue, 22 Jun 2004 14:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:162431</guid><dc:creator>Raymond Chen</dc:creator><description>I have no idea. But instead of just saying &amp;quot;Gosh I will never know&amp;quot;, I decided to search on google for &amp;quot;site:msdn.microsoft.com surrogate pairs&amp;quot; and it found this page&lt;br&gt;&lt;a target="_new" href="http://msdn.microsoft.com/library/en-us/intl/unicode_192r.asp"&gt;http://msdn.microsoft.com/library/en-us/intl/unicode_192r.asp&lt;/a&gt; . Please, people, don't be lazy. Do some searching yourself before asking questions. I have better things to do with my time.</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#162447</link><pubDate>Tue, 22 Jun 2004 15:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:162447</guid><dc:creator>Holger Dors</dc:creator><description>I'm sorry to have wasted your time, Raymond, but I really did search earlier for an answer to this. It just never occured to me to search for &amp;quot;surrogate pairs&amp;quot;.&lt;br&gt;&lt;br&gt;But finally, thanks to you, I have an answer: starting with W2K UTF-16 (and therefore surrogate pairs) are supported, up until then it was UCS-2.&lt;br&gt;&lt;br&gt;Many thanks for your help!</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#163082</link><pubDate>Wed, 23 Jun 2004 00:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:163082</guid><dc:creator>Marcdlg</dc:creator><description>&amp;gt; PPC, MIPS, Alpha AXP, ia64 all crash if you access unaligned data. x86 is the weirdo: It permits unaligned data access. &lt;br&gt;&lt;br&gt;Raymond,&lt;br&gt;&lt;br&gt;I cannot resist the pedantic urge to correct this.&lt;br&gt;&lt;br&gt;-AFAIK there are no PPC CPUs which do not support unaligned integer data access in hardware.&lt;br&gt;&lt;br&gt;-MIPS generate a precise exception that allows the kernel to emulate in software the unaligned access. (Granted this is dead slow. And a more than sufficient reason to avoid unaligned data at all cost. (e.g. for a packed struct a MIPS compiler will generate 4 load byte instructions to access a dword)&lt;br&gt;&lt;br&gt;-Alpha probably does software emulation too, since it is frequently impossible to statically determine if an access is aligned or not.&lt;br&gt;&lt;br&gt;And having worked on optimizing network stack code for MIPS, x86 is a smart &amp;quot;weirdo&amp;quot;.&lt;br&gt;&lt;br&gt;&lt;br&gt; &lt;br&gt;</description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#163871</link><pubDate>Wed, 23 Jun 2004 17:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:163871</guid><dc:creator>Ben Hutchings</dc:creator><description>Marcdlg: Support for misaligned access is an optional feature of the PowerPC architecture, at least in little-endian mode (which is what Windows uses). The early PowerPCs (601, 603, 604) raise an exception for it. </description></item><item><title>re: The evolution of dialog templates - 32-bit Classic Templates</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#185540</link><pubDate>Fri, 16 Jul 2004 18:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:185540</guid><dc:creator>Raymond Chen</dc:creator><description>asdf: 0xFF 0xFF and 0xFF 0x00 are both valid and mean different things! I was not sufficient clear.&lt;br&gt;&lt;br&gt;0xFF 0xFF means &amp;quot;What comes next is a special class ordinal (0x80 = button, etc.)&amp;quot;.&lt;br&gt;&lt;br&gt;0xFF 0x00 means &amp;quot;What comes next is a class ordinal (atom).&amp;quot;</description></item><item><title>The evolution of dialog templates - Summary</title><link>http://blogs.msdn.com/oldnewthing/archive/2004/06/21/161375.aspx#442119</link><pubDate>Sat, 23 Jul 2005 04:13:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:442119</guid><dc:creator>The Old New Thing</dc:creator><description>Trying to capture the changes in a table.</description></item></channel></rss>