🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #838

Re: Omission re static linkage

#838
From: Walter Murray
Date: Mon, 23 Oct 1989 19:44
31 lines
1383 bytes
> Consider the following program:

> void f1() {
>   extern void f3(void);  /* [1] */
> }
> void f2() {
>   static void f3(void);  /* [2] */
> }
> static void f3() {       /* [3] */
> }

> According to section 3.1.2.2, declarations [1] and [3] refer to the
> same identifier, and function f3 has internal linkage.  

No, as I read it, the f3 declared in [1] has external linkage because
there is no visible declaration with file scope at that point.  The
f3 declared in [3] does indeed have internal linkage.  Because the
same identifier appears with both external and internal linkage,
behavior is undefined.

> However, the
> standard neglects to state what declaration [2] refers to.

Declaration [2] violates a constraint of 3.5.1:  "The declaration
of an identifier for a function that has block scope shall have no
explicit storage-class specifier other than extern."

> Norman Diamond, Sony Corp.

Walter Murray
----------
Technical Details
Message-ID: <12570029@hpclwjm.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!apple!motcsd!hpda!hpcuhb!hpcllla!hpclisp!hpclwjm!walter
References: <10975@riks.csl.sony.co.jp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!apple!motcsd!hpda!hpcuhb!hpcllla!hpclisp!hpclwjm!walter
From: walter@hpclwjm.HP.COM (Walter Murray)
Newsgroups: comp.std.c
Subject: Re: Omission re static linkage
Message-ID: <12570029@hpclwjm.HP.COM>
Date: 23 Oct 89 19:44:55 GMT
References: <10975@riks.csl.sony.co.jp>
Organization: Hewlett-Packard Calif. Language Lab
Lines: 31