{"id":11113,"date":"2011-03-28T07:00:00","date_gmt":"2011-03-28T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2011\/03\/28\/why-did-win32-define-bool-as-a-signed-int-instead-of-an-unsigned-int\/"},"modified":"2011-03-28T07:00:00","modified_gmt":"2011-03-28T07:00:00","slug":"why-did-win32-define-bool-as-a-signed-int-instead-of-an-unsigned-int","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20110328-00\/?p=11113","title":{"rendered":"Why did Win32 define BOOL as a signed int instead of an unsigned int?"},"content":{"rendered":"<p>Igor Levicki wants somebody from Microsoft to explain <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2008\/11\/26\/9143050.aspx#9157501\"> why <code>BOOL<\/code> was defined as a <code>signed int<\/code> instead of an <code>unsigned int<\/code><\/a>.\n You don&#8217;t need to work for Microsoft to figure this out. All the information you need is publically available.<\/p>\n<p> Quoting from K&amp;R Classic, which was the operative C standards document at the time Windows was being developed: <\/p>\n<blockquote class=\"q\">\n<p> 7.6 Relational Operators <\/p>\n<p> The [relational operators] all yield 0 if the specified relation is false and 1 if it is true. The type of the result is <code>int<\/code>. <\/p>\n<\/blockquote>\n<p> Win32 defined <code>BOOL<\/code> as synonymous with <code>int<\/code> because Brian and Dennis said so. If you want to know why Brian and Dennis decided to have the result of relational operators be signed instead of unsigned, you&#8217;ll have to ask them. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Igor Levicki wants somebody from Microsoft to explain why BOOL was defined as a signed int instead of an unsigned int. You don&#8217;t need to work for Microsoft to figure this out. All the information you need is publically available. Quoting from K&amp;R Classic, which was the operative C standards document at the time Windows [&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-11113","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Igor Levicki wants somebody from Microsoft to explain why BOOL was defined as a signed int instead of an unsigned int. You don&#8217;t need to work for Microsoft to figure this out. All the information you need is publically available. Quoting from K&amp;R Classic, which was the operative C standards document at the time Windows [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/11113","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=11113"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/11113\/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=11113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=11113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=11113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}