"static" keyword used with function names

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Jul 27 05:17:48 AEST 1990


In article <79253 at cc.utah.edu> ORCUTT at 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.)



More information about the Comp.std.c mailing list