title: Type of unsigned long is different from uint32_t and uint64_t on Windows (VS2010)
body: <p>On Visual Studio 2010 under Windows 7, 32bit, unsigned long seems to be a distinct type from both uint32_t and uint64_t. See the following test program:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;stdint.h&gt;
  #include &lt;stdio.h&gt;
  
  template&lt;class T, class U&gt;
  struct is_same_type
  {
      static const bool value = false;
  };
  template&lt;class T&gt;
  struct is_same_type&lt;T, T&gt;
  {
      static const bool value = true;
  };
  
  #define TO_STRING(arg)        TO_STRING_IMPL(arg)
  #define TO_STRING_IMPL(arg)   #arg
  
  #define PRINT_SAME_TYPE(type1, type2) printf("%s (size=%d) %s %s (size=%d)\n", \
      TO_STRING(type1), int(sizeof(type1)), \
      is_same_type&lt;type1, type2&gt;::value ? "==" : "!=", \
      TO_STRING(type2), int(sizeof(type2)))
  
  
  int main(int /*argc*/, const char* /*argv*/[])
  {
      PRINT_SAME_TYPE(uint32_t, unsigned long);
      PRINT_SAME_TYPE(uint64_t, unsigned long);
      return 0;
  }
  </code></pre>
  
  <p>I'd expect it to print either</p>
  
  <pre><code>uint32_t (size=4) != unsigned long (size=8)
  uint64_t (size=8) == unsigned long (size=8)
  </code></pre>
  
  <p>(which I get on x86_64 Linux) or</p>
  
  <pre><code>uint32_t (size=4) == unsigned long (size=4)
  uint64_t (size=8) != unsigned long (size=4)
  </code></pre>
  
  <p>assuming of course that long is not longer than 64bits.</p>
  
  <p>On Windows however, I get the baffling</p>
  
  <pre><code>uint32_t (size=4) != unsigned long (size=4)
  uint64_t (size=8) != unsigned long (size=4)
  </code></pre>
  
  <p>which means that there are two distinct 32bit unsigned types. Is this allowed by the C++ standard? Or is this a bug in the Visual C++ compiler?</p>