This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Problem using global const for array size
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Problem using global const for array size
- From: Tron Thomas <tron dot thomas at sierra dot com>
- Date: Thu, 04 May 2000 21:28:35 -0700
I am using egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) that came
with RedHat 6.0 (Intel)
I compiled the following program using "gcc -d -Wall"
const int nSIZE = 8;
int main(void)
{
char szText[nSIZE + 1];
exit(0);
}
I get the following results:
In function 'main':
size of array 'szText' is too large
The size of szText array should only be 9 bytes, which should be
considered too large.
If I compile this code:
int main(void)
{
const int nSIZE = 8;
char szText[nSIZE + 1];
exit(0);
}
It compiles without error.