title: What are the implications of using static const instead of #define?
body: <p>gcc complains about this:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  static const int YY = 1024;
  extern int main(int argc, char*argv[])
  {  
    static char x[YY];
  }
  </code></pre>
  
  <p>$ gcc -c test1.c
  test1.c: In function <code>main':
  test1.c:5: error: storage size of</code>x' isn't constant
  test1.c:5: error: size of variable `x' is too large</p>
  
  <p>Remove the “static” from the definition of x and all is well. </p>
  
  <p>I'm not exactly clear what's going on here: surely YY <em>is</em> constant?</p>
  
  <p>I had always assumed that the "static const" approach was preferable to "#define". Is there any way of using "static const" in this situation?</p>