title: Compile-time assert on datatype sizes
body: <p>I would like to perform a compile-time check on datatype sizes in a C/C++ project, and error on unexpected mismatches. Simple</p>
  
  <pre><code>#if sizeof foo_t != sizeof bar_t
  </code></pre>
  
  <p>does not compile - claims that sizeof is not a proper compile-time constant.</p>
  
  <p>The desired scope of platforms - at the very least Visual C++ with Win32/64, and GCC on x86/amd64.</p>
  
  <p><strong>EDIT</strong>: compile-time, not necessarily preprocessor. Just not a run-time error.</p>
  
  <p><strong>EDIT2</strong>: the code assumes that <code>wchar_t</code> is 2 bytes. I want a compilation error if it's accidentally compiled with 4-byte wchar's.</p>