This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem using global const for array size


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]