🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #830

Re: question about linkage

#830
From: Matthew Self
Date: Mon, 23 Oct 1989 18:53
26 lines
1365 bytes
henry@utzoo.uucp (Henry Spencer) writes:
>In article <80@bomb.next.com> mself@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!
Technical Details
Message-ID: <83@bomb.next.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!apple!coherent!next!mself
References: <80@bomb.next.com> <1989Oct21.235728.23815@utzoo.uucp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!apple!coherent!next!mself
From: mself@next.com (Matthew Self)
Newsgroups: comp.std.c
Subject: Re: question about linkage
Message-ID: <83@bomb.next.com>
Date: 23 Oct 89 18:53:51 GMT
References: <80@bomb.next.com> <1989Oct21.235728.23815@utzoo.uucp>
Reply-To: mself@bomb.UUCP (My Account)
Organization: NeXT, Inc.
Lines: 26