Deutsch   English   Français   Italiano  
<vt8ei8$2vn84$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: do { quit; } else { }
Date: Thu, 10 Apr 2025 14:46:00 +0200
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <vt8ei8$2vn84$1@dont-email.me>
References: <vspbjh$8dvd$1@dont-email.me> <8634enhcui.fsf@linuxsc.com>
 <vsph6b$ce6m$5@dont-email.me> <86ldsdfocs.fsf@linuxsc.com>
 <20250406161323.00005809@yahoo.com> <86ecy5fjin.fsf@linuxsc.com>
 <20250406190321.000001dc@yahoo.com> <86plhodtsw.fsf@linuxsc.com>
 <20250407210248.00006457@yahoo.com> <vt15lq$bjs0$3@dont-email.me>
 <vt2lp6$1qtjd$1@dont-email.me> <vt31m5$2513i$1@dont-email.me>
 <vt3d4g$2djqe$1@dont-email.me> <vt3iqh$2ka99$1@dont-email.me>
 <vt5fed$ccri$1@dont-email.me> <vt5js2$g1t7$1@dont-email.me>
 <20250409142303.00004645@yahoo.com> <87ikndqabc.fsf@nosuchdomain.example.com>
 <20250410115501.000037a5@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 10 Apr 2025 14:46:01 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="d51e7b029d04c4630234dc8501376c73";
	logging-data="3136772"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/GV19y7abrkDzkj8ZUkQrwaXxmhOyWKH0="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Cancel-Lock: sha1:GN7g1oGM8c0/qFEyQd9ggLR9mcU=
In-Reply-To: <20250410115501.000037a5@yahoo.com>
Content-Language: en-GB
Bytes: 4223

On 10/04/2025 10:55, Michael S wrote:
> On Wed, 09 Apr 2025 14:44:39 -0700
> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> 
>> Michael S <already5chosen@yahoo.com> writes:
>>> On Wed, 9 Apr 2025 12:58:08 +0200
>>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>>>   
>>>> On 09.04.2025 11:42, David Brown wrote:
>>>>> On 08/04/2025 18:28, bart wrote:
>>>>>> [...]
>>>>>
>>>>> I believe the meaning of "extern" in combination with other
>>>>> storage-class specifiers was picked to work with existing old
>>>>> code from before "extern" was added to the language.
>>>>
>>>> Assuming you mean the "C" language I don't quite understand the
>>>> last part of the sentence. Wasn't 'extern' already in "K&R" - so
>>>> what was "the language" before the addition of 'extern'?
>>>>
>>>> Or did you just mean to say "[...] before _combinations_ of
>>>> 'extern' and other storage-class specifier were added to the
>>>> language."
>>>>
>>>> Janis, puzzled
>>>
>>> K&R was published in 1978, 5 years after C got its first users.
>>> Back in 1973-74 C language was significantly different from what it
>>> became few years later.
>>
>> The earliest C reference I have is cman74.pdf, currently at
>> <http://cm.bell-labs.co/who/dmr/cman74.pdf>.  It includes "extern" in
>> the list of keywords.
>>
>> It was inherited from B, which had "extrn" as a keyword as of 1972.
>>
> 
> O.k. Then David Brown will have to look for different justification for
> this particular misfeature of great majority of Unix implementations of
> C language.
> 

There have been a variety of things under discussion here, but I think 
this particular one was about the linkage rules in C if an identifier is 
declared with "static int foo;" and/or "extern int foo;" and/or "int 
foo;" at file scope, possibly in different orders.  My thought was that 
one influence on the rules was consistency of existing code after 
"extern" was added to the language, but it seems unlikely since no one 
knows of an early C without "extern".

So currently, I have no explanation for why you may write "static int 
foo; extern int foo;" and have "foo" be internal linkage, while "extern 
int foo; static int foo;" is not allowed.  Given that neither are likely 
to be of the remotest use, nor likely to be written by accident and go 
unnoticed, it should not affect anyone significantly.

But if someone else has an explanation for this, or a realistic use-case 
for static followed by extern, I am curious to hear about it.