Joerg Schilling wrote:
Cyril Plisko <[EMAIL PROTECTED]> wrote:
What do you get from the compiler when you write:
extern int test[];
Jörg
zulu:/tmp> cat ar.c
extern int test[];
void empty(void)
{
test[1] = 0;
}
zulu:/tmp> /opt/polaris/bin/powerpc-solaris2-gcc -c -Wall ar.c
zulu:/tmp>
And another test
zulu:/tmp> cat ar2.c
extern struct foo test[];
struct foo {
int i;
char b;
};
void empty(void)
{
test[1].i = 0;
}
zulu:/tmp> /opt/polaris/bin/powerpc-solaris2-gcc -c -Wall ar2.c
ar2.c:1: error: array type has incomplete element type
zulu:/tmp>
This seems to verify a compiler bug.
In contrary to
extern struct foo *p;
the [] notation needs to know the size but it should be sufficient
if the compile knows the size before the variable is used.
Jörg
Apparently, C prohibits declaration like this -
http://gcc.gnu.org/ml/gcc/2005-02/msg00053.html
http://gcc.gnu.org/ml/gcc/2005-02/msg00054.html
Cyril
_______________________________________________
opensolaris-code mailing list
[email protected]
https://opensolaris.org:444/mailman/listinfo/opensolaris-code