🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2097

undefined statics become externs?

#2097
From: Bill Sommerfeld
Date: Fri, 30 Dec 1988 01:47
23 lines
1190 bytes
It seems reasonable (to me at least) for a C compiler to complain
about the following source file:

----
static int foo();

static int (*bar)() = foo;
----

since foo is never defined anywhere in the file.

GCC (1.32/VAX) doesn't complain.  But then again, neither does PCC, or
High C, or Domain/OS C; all these compilers merely treat "foo" as if
it were declared "extern" rather than "static".

For you language lawyers out there: does the dpANS say anything about
this?  Ken Raeburn looked at it (very briefly) but couldn't find
anything explicit about undefined static functions (it was mentioned
that declared but undefined static "objects" were initialized to zero,
but the definition of "object" used in the dpANS appears to exclude
function bodies).

					- Bill
Technical Details
Message-ID: <8812300147.AA11412@ANUBIS.MIT.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!osu-cis!tut.cis.ohio-state.edu!ATHENA.MIT.EDU!wesommer

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!osu-cis!tut.cis.ohio-state.edu!ATHENA.MIT.EDU!wesommer
From: wesommer@ATHENA.MIT.EDU (Bill Sommerfeld)
Newsgroups: gnu.gcc.bug
Subject: undefined statics become externs?
Message-ID: <8812300147.AA11412@ANUBIS.MIT.EDU>
Date: 30 Dec 88 01:47:35 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 23