title: How to determine the length of an array at compile time?
body: <p>Are there macros or builtins that can return the length of arrays at compile time in GCC?</p>
  
  <p>For example:</p>
  
  <pre><code>int array[10];
  </code></pre>
  
  <p>For which:</p>
  
  <pre><code>sizeof(array) == 40
  ???(array) == 10
  </code></pre>
  
  <h2>Update0</h2>
  
  <p>I might just point out that doing this in C++ is trivial. One can build a template that returns the number inside <code>[]</code>. I was certain that I'd once found a <code>lengthof</code> and <code>dimof</code> macro/builtin in the Visual C++ compiler but cannot find it anymore.</p>