integer constants in C: #define versus static const int x = 1234;
gcc complains about this:

    #include <stdio.h>
    static const int YY = 1024;
    extern int main(int argc, char*argv[])
    {  
      static char x[YY];
    }

$ gcc -c test1.c
test1.c: In function `main':
test1.c:5: error: storage size of `x' isn't constant
test1.c:5: error: size of variable `x' is too large

Remove the “static” from the definition of x and all is well. 

I'm not exactly clear what's going on here: surely YY _is_ constant?

I had always assumed that the "static const" approach was preferable to "#define". Is there any way of using "static const" in this situation?
integer constants in C: #define versus static const int x = 1234;
===

gcc complains about this:

    #include <stdio.h>
    static const int YY = 1024;
    extern int main(int argc, char*argv[])
    {  
      static char x[YY];
    }

$ gcc -c test1.c
test1.c: In function `main':
test1.c:5: error: storage size of `x' isn't constant
test1.c:5: error: size of variable `x' is too large

Remove the “static” from the definition of x and all is well. 

I'm not exactly clear what's going on here: surely YY _is_ constant?

I had always assumed that the "static const" approach was preferable to "#define". Is there any way of using "static const" in this situation?