c/4698: constant beginning with 0 as array index
Martin Kahlert
martin.kahlert@infineon.com
Fri Oct 26 08:21:00 GMT 2001
Hi!
On Fri, Oct 26, 2001 at 04:40:19PM +0200, bonnaud@iut2.upmf-grenoble.fr wrote:
> The following program does not compile:
>
> int main(void)
> {
> int tab[011];
>
> tab[09]=1; /* error here only */
> tab[10]=02;
> }
This is not gcc's error but an error by you.
011 is (in C, C++) the octal value 011 and thus == 9.
09 would be an octal value, but each digit of an octal value must be < 8.
Gcc tries to tell you this with its error message.
Hope that helps,
Martin.
--
The early bird catches the worm. If you want something else for
breakfast, get up later.
More information about the Gcc-bugs
mailing list