🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4021

Re: Initializing internal linkage block scope variables.

#4021
From: Tanmoy Bhattacharya
Date: Mon, 18 Sep 1995 15:17
37 lines
1811 bytes
In article <43k0p4$mjv@rdsunx.crd.ge.com>, volpe@bart.crd.ge.com (Christopher
R. Volpe) writes: 
|> For years I've used code like:
|> 
|> foo()
|> {
|>   static int count_number_of_calls = 0;
|> 
|>   count_number_of_calls++;
|>   /* Do other stuff */
|> }
|> 
|> However, this appears to violate the fourth constraint in ANSI Classic
section 
|> 3.5.7. Am I reading this right? Gcc -ansi -pedantic accepts it without so
much 
|> as a peep, and I can't think of why it ought to be illegal, but apparently
it 
|> is. 

I hope that is ANSI/ISO 6.5.7. I do not understand what you are
referring to. count_number_of_calls here has no linkage (6.1.2.2 makes clear
that static specifies internal linkage only for a file scope object or
function: this identifier does not have file scope) : so it does not have
`external or internal' linkage: so the fourth constraint does not apply.

Could you clarify?

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,NM87544-0285,USA H:#3,802,9 St,NM87545
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: <43k2j5$nqi@newshost.lanl.gov>
Path: arc1-ca.pugleaf.net!qcd.lanl.gov!tanmoy
References: <43k0p4$mjv@rdsunx.crd.ge.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!qcd.lanl.gov!tanmoy
From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
Newsgroups: comp.std.c
Subject: Re: Initializing internal linkage block scope variables.
Date: 18 Sep 1995 15:17:57 GMT
Organization: Los Alamos National Laboratory
Distribution: world
Message-ID: <43k2j5$nqi@newshost.lanl.gov>
References: <43k0p4$mjv@rdsunx.crd.ge.com>
NNTP-Posting-Host: qcd.lanl.gov