🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1526

Re: "static" keyword used with function names

#1526
From: Doug Gwyn
Date: Thu, 26 Jul 1990 19:17
16 lines
1101 bytes
In article <79253@cc.utah.edu> ORCUTT@cc.utah.edu writes:
>static int func(void);     /* A declaration */
>...
>static int func(void)      /* A definition */
>{
>...
>}

This is fine, so long as both these occur at file scope.  A block-scope
function declaration must not include the "static" storage-class specifier.

If you were to omit the first "static", that "func" would have external
linkage (assuming no previous internal-linkage declaration were visible
at that point), which is not what you want.  (The behavior when the same
identifier has been declared in the same scope with both internal and
external linkage is undefined, i.e. not something to rely on.)
Technical Details
Message-ID: <13419@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!seismo!ukma!rex!samsung!dali.cs.montana.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn
References: <79253@cc.utah.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!seismo!ukma!rex!samsung!dali.cs.montana.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: "static" keyword used with function names
Message-ID: <13419@smoke.BRL.MIL>
Date: 26 Jul 90 19:17:48 GMT
References: <79253@cc.utah.edu>
Organization: U.S. Army Ballistic Research Laboratory, APG, MD.
Lines: 16