question about linkage
Matthew Self
mself at next.com
Tue Oct 24 04:53:51 AEST 1989
henry at utzoo.uucp (Henry Spencer) writes:
>In article <80 at bomb.next.com> mself at bomb.UUCP (My Account) writes:
>>How, then, can you forward declare an object with internal
>>linkage whose size isn't known when you forward declare it?
>>[old solution which sometimes works is non-ANSI, ANSI solution is not
>> acceptable to some old compilers]
^^^^^^^^^^^^^
What ANSI solution?
How can you forward declare a static object of variable size in ANSI C?
This doesn't work:
static int foo[];
/* many uses of foo here. */
static int foo[] = {0, 1, 2, 3}; /* now that I know how big it is */
GCC will not compile this, complaining that the first declaration of foo
has unknown size. I asked RMS whether ANSI required this behaviour,
and he said yes. Is this a bug in GCC?
As far as I have been able to tell, there is NO way to forward declare
a static array in ANSI C. This is a serious step backward!
More information about the Comp.std.c
mailing list