{"id":1462,"date":"2015-02-03T04:55:29","date_gmt":"2015-02-02T18:55:29","guid":{"rendered":"http:\/\/brnz.org\/hbr\/?p=1462"},"modified":"2015-02-03T09:42:51","modified_gmt":"2015-02-02T23:42:51","slug":"whats-the-difference-between-0xffffffff-and-0xffffffffu","status":"publish","type":"post","link":"https:\/\/brnz.org\/hbr\/?p=1462","title":{"rendered":"What&#8217;s the difference between 0xffffffff and 0xffffffffu?"},"content":{"rendered":"<p>In C++, what is the difference between <strong>0xffffffff<\/strong> and <strong>0xffffffffu<\/strong>?<\/p>\n<p>This one&#8217;s pretty easy to answer with this information from the C++ standard:<\/p>\n<blockquote><p>The type of an integer literal is the first of the corresponding list in Table 6 in which its value can be represented.<img loading=\"lazy\" class=\"aligncenter\" src=\"https:\/\/brnz.org\/hbr\/wp-content\/uploads\/2015\/01\/types_of_integer_constants.png\" alt=\"\" width=\"993\" height=\"711\" \/><\/p><\/blockquote>\n<p><strong>0xffffffff<\/strong> is a hexadecimal constant, it&#8217;s too big to be represented in a (<strong>signed<\/strong>) <strong>int<\/strong>, so &#8212; by the terms of the standard &#8212; the type of <strong>0xffffffff<\/strong> is <strong>unsigned int<\/strong>.<\/p>\n<p>Furthermore, each of these hexadecimal literals will have a different type:<\/p>\n<pre escaped=\"true\" lang=\"c++\">0x7fffffff   \/\/ int\r\n0xffffffff   \/\/ unsigned int\r\n0x1ffffffff  \/\/ long int (or long long int)\r\n0x1ffffffffu \/\/ unsigned long int (or unsigned long long int)\r\n<\/pre>\n<p>But to answer the original question, there is no difference between <strong>0xffffffff<\/strong> and <strong>0xffffffffu<\/strong>\u00a0apart from this:<\/p>\n<blockquote class=\"twitter-tweet\" lang=\"en\" data-conversation=\"none\"><p><a href=\"https:\/\/twitter.com\/twoscomplement\">@twoscomplement<\/a> One is a commonly used curse when the compiler screws up.<\/p>\n<p>\u2014 Colin Riley (@domipheus) <a href=\"https:\/\/twitter.com\/domipheus\/status\/561310003554816001\">January 30, 2015<\/a><\/p><\/blockquote>\n<p><script src=\"\/\/platform.twitter.com\/widgets.js\" async=\"\" charset=\"utf-8\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In C++, what is the difference between 0xffffffff and 0xffffffffu? This one&#8217;s pretty easy to answer with this information from the C++ standard: The type of an integer literal is the first of the corresponding list in Table 6 in which its value can be represented. 0xffffffff is a hexadecimal constant, it&#8217;s too big to &hellip; <a href=\"https:\/\/brnz.org\/hbr\/?p=1462\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;What&#8217;s the difference between 0xffffffff and 0xffffffffu?&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,26],"tags":[],"_links":{"self":[{"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=\/wp\/v2\/posts\/1462"}],"collection":[{"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1462"}],"version-history":[{"count":5,"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=\/wp\/v2\/posts\/1462\/revisions"}],"predecessor-version":[{"id":1467,"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=\/wp\/v2\/posts\/1462\/revisions\/1467"}],"wp:attachment":[{"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brnz.org\/hbr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}