🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2159

Re: "extern" and function declarations

#2159
From: Tanmoy Bhattacharya
Date: Mon, 04 Mar 1996 06:54
47 lines
2196 bytes
In article <4hdqjq$8pr@solutions.solon.com>
fred@genesis.demon.co.uk (Lawrence Kirby) writes:
<snip>
LK: I'm curious - do people find this enlightening (you learnt something),
LK: obvious (you knew it already, comp.std.c regulars need not apply),
LK: unintelligible (I didn't explain it very clearly) or uninteresting (not
LK: worth the bandwidth)?

I am amused at the fact that you went to so much trouble to explain
the details of extern, static, even tentative definitions; but failed
to include the behaviour of the following four program fragments:

1)
static int i;
extern int i; /* still internal linkage */

2)
extern int i; /* external linkage */
static int i; /* undefined behaviour: why is no diagnostic required? */

3)
static int i;
void f(void) { int j; 
                { extern int i; /* still internal linkage */}
             }

4)
static int i;
void f(void) { int i;
		{ extern int i; /* external linkage! undefined
                                   behaviour */}
             }
(refer TC1).

Just curious: why? The explanation would clarify that extern does not
necessarily imply external linkage: rather it says that unless it is
visibly declared with internal linkage, it has external linkage.

Cheers
Tanmoy
--
tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
<http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
Technical Details
Message-ID: <4he42q$a7q@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4hdqjq$8pr@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: tanmoy@qcd.Lanl.GOV (Tanmoy Bhattacharya)
Newsgroups: comp.lang.c.moderated
Subject: Re: "extern" and function declarations
Date: 4 Mar 1996 00:54:18 -0600
Organization: Los Alamos National Laboratory
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4he42q$a7q@solutions.solon.com>
References: <4hdqjq$8pr@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com