[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

constant beginning with 0 as array index



>Submitter-Id:	net
>Originator:	
>Confidential:	no
>Synopsis:	constant beginning with 0 as array index does not compile
>Severity:	non-critical
>Priority:	low
>Category:	c
>Class:		rejects-legal
>Release:	3.0.2 (Debian) (Debian testing/unstable)
>Environment:
System: Linux pc-dg-116-1 2.4.12-686 #2 Sat Oct 13 20:13:05 EST 2001 i686 unknown
Architecture: i686

host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:

The following program does not compile:

int main(void)
{
  int tab[011];

  tab[09]=1;      /* error here only */
  tab[10]=02;
}

Is it a legal program or is there some subtle C/C++ rule that say it
is not ?

>How-To-Repeat:

$ gcc essai.c
essai.c: In function `main':
essai.c:5: numeric constant contains digits beyond the radix

The same error happens both with gcc and g++.  I tested versions
2.95.x and 3.0.x.



Reply to: