https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15360

--- Comment #10 from Andrei Cherniaev <dungeonlords789 at yandex dot ru> ---
I suggest allow use directive extern without array size.

main.c:
#define size ( 1 ) 
char arr[size];

int main()
{
    return 0;
}

second.c:
extern char arr[];

void f(){
    sizeof(arr);
}

It was error: 
invalid application of 'sizeof' to incomplete type 'char[]'

I can modify second.c: extern char arr[size];
But I ned export my define to second.c... It is not flexiable.

More than that, I can use mistake: in one file one size and in second size will
another...
main.c:
char arr[1];

int main()
{
    return 0;
}

second.c:
extern char arr[999];

void f(){
    sizeof(arr);
}

I think gcc should prevent it error. But now I can't see even warning...

So I suggest allow to use directive extern without array size.

Reply via email to