Undetected error in array declarations...
Mike Simons
msimons@fsimons01.erols.com
Wed Dec 2 09:37:00 GMT 1998
Hello all,
If a function call is given as a array size, the compiler uses a size of 8.
Even when "-Wall -W" is used, there are no messages about a function call in
array definitions being illegal.
I think the compiler should flag this as an error... or if for some reason
that may be valid syntax, at the very least issue a warning when -Wall is on.
Thanks,
Mike Simons
compiler used:
msimons@gabriel:~> egcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/egcs-2.91.58/specs
gcc version egcs-2.91.58 19981101 (egcs-1.1.1 pre-release 2, Debian 2.1)
...but I have tried this with various versions of gcc 2.7.* through the
egcs version given above.
here is an example:
===========
#include <string.h>
int main(void)
{
int foo[strlen("something really long")];
int bar[strlen("")][10];
int baz[10][strlen("")];
return 0;
}
More information about the Gcc-bugs
mailing list