title: Behaviour of sizeof() in C (GCC)
body: <p>While answering a question on sizeof(), just to see how GCC handles, I wrote the following code:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stddef.h&gt;
  #include&lt;limits.h&gt;
  
  int main(int ac, char *argv[])
  {
      printf("%zu\n", sizeof(9999999999999999999999999999999999999999999999999999) );
      printf("%zu %zu \n", sizeof(int), sizeof(long long));
      return 0;
  }
  </code></pre>
  
  <p>When compiled, GCC (4.1.2) issued a warning (as expected):</p>
  
  <pre><code>t.c:8:24: warning: integer constant is too large for its type
  t.c: In function main:
  t.c:8: warning: integer constant is too large for long type
  </code></pre>
  
  <p>And the output is:</p>
  
  <pre><code>16
  4 8
  </code></pre>
  
  <p>How does GCC say that <code>sizeof(9999999999999999999999999999999999999999999999999999)</code> is 16 ?! No matter how big <code>numnber</code> is, it's always 16 for any integer literal greater than <code>LLONG_MAX</code>. On my 64-bit platform <code>sizeof(long)</code> is equal to <code>sizeof(long long)</code>.</p>
  
  <p>Why does GCC behave this way? Is it some sort of undefined behaviour?!</p>