Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3042

Expected constant expression

$
0
0
In MSVC-8 (VS2005) it isn't possible to declare an array using a variable name for the array size - i.e.

Code:

int somevar = 20;
int array[somevar];

The above causes an error ("expected constant expression") at the line where the array gets declared. But I gather that it's legal in more recent versions of MSVC. Does anyone known when it became legal (i.e. which version)? It's just so I can make a suitable #define

Viewing all articles
Browse latest Browse all 3042

Trending Articles