How come the compiler thinks this variable isn't constant?
问题 This is my code: int main() { const int LEN = 5; int x[LEN]; } VS10 says: error C2057: expected constant expression error C2466: cannot allocate an array of constant size 0 error C2133: 'x' : unknown size I even tried the the code in this page and it gives the same problem (I commented the code which gives the error, and uncommented the correct one): http://msdn.microsoft.com/en-us/library/eff825eh%28VS.71%29.aspx If I was trying a crappy compiler, I would think it's a bug in the compiler,