P
Poster Matt
Hi,
The following code results in the following error with GCC (v.4.3.2):
const int eodSize = 8192;
char eodContents[eodSize];
error: variably modified 'eodContents' at file scope
It is, of course, easily solved by ditching the 'const int' and using a #define
instead like this:
#define eodSize 8192
char eodContents[eodSize];
I would understand the error if "const int eodSize = 8192;" was not a constant
but since it is a constant why does the compiler not allow it?
Thanks.
The following code results in the following error with GCC (v.4.3.2):
const int eodSize = 8192;
char eodContents[eodSize];
error: variably modified 'eodContents' at file scope
It is, of course, easily solved by ditching the 'const int' and using a #define
instead like this:
#define eodSize 8192
char eodContents[eodSize];
I would understand the error if "const int eodSize = 8192;" was not a constant
but since it is a constant why does the compiler not allow it?
Thanks.