🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1522

"static" keyword used with function names

#1522
From: ORCUTT
Date: Tue, 24 Jul 1990 03:37
24 lines
1168 bytes
I have a question about the incarnation of the "static" keyword
that tells C that a function or variable name is only visible in
the current file.  If I write

static int func(void);     /* A declaration */

.
.
.

static int func(void)      /* A definition */
{
/* do something */
return something;
}

H & S have a passage that seems to say that the "static" on
the declaration is illegal.  If I omit it, however, it would seem
that the function would be defaulted to type "extern" and then
the definition of type "static" would conflict with the declaration.
My Turbo-C and MSC compilers seem to allow the "static" in the 
delcaration, but my Metaware compiler complains.  So, how do
I correctly declare a function name "static" if I want
to declare the name earlier in the file that its definition?
Technical Details
Message-ID: <79253@cc.utah.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!helios.ee.lbl.gov!hellgate.utah.edu!cc.utah.edu!orcutt

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!helios.ee.lbl.gov!hellgate.utah.edu!cc.utah.edu!orcutt
From: ORCUTT@cc.utah.edu
Newsgroups: comp.std.c
Subject: "static" keyword used with function names
Message-ID: <79253@cc.utah.edu>
Date: 24 Jul 90 03:37:08 GMT
Lines: 24
X-Local-Date: 23 Jul 90 20:37:08 PDT