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

-- 
 EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin
       [EMAIL PROTECTED]                (uni)  
       [EMAIL PROTECTED]        (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
opensolaris-code mailing list
[email protected]
https://opensolaris.org:444/mailman/listinfo/opensolaris-code

Reply via email to