Deutsch   English   Français   Italiano  
<vt5otg$inuo$4@dont-email.me>

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

Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!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: Wed, 9 Apr 2025 14:24:15 +0200
Organization: A noiseless patient Spider
Lines: 65
Message-ID: <vt5otg$inuo$4@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> <20250409131633.000052f3@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 09 Apr 2025 14:24:16 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="39048323a720df50869558e92437b3ec";
	logging-data="614360"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+4RNvMKjB3oslPF7b6obVFOEZj6Jcrtmc="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Cancel-Lock: sha1:WaZ12VRR7VCW+EOIchZR3ncLz3o=
Content-Language: en-GB
In-Reply-To: <20250409131633.000052f3@yahoo.com>
Bytes: 4632

On 09/04/2025 12:16, Michael S wrote:
> On Wed, 9 Apr 2025 11:42:36 +0200
> David Brown <david.brown@hesbynett.no> wrote:
> 
>> On 08/04/2025 18:28, bart wrote:
>>> On 08/04/2025 15:50, David Brown wrote:
>>>> On 08/04/2025 13:35, bart wrote:
>>>> But it is true that some compilers have by default supported an
>>>> extension that was designed to make interoperability with Fortran
>>>> programs easier
>>>
>>> Which means a pile of badly written programs.
>>
>> That is why I said it was a bad idea for gcc to have "-fcommon" as
>> the default.  It is a real shame that it took so long to change it.
>>
>> However, while that default meant that some people wrote C code with
>> a misunderstanding of linkages and the difference between
>> declarations and definitions, most C programmers don't make that
>> mistake.  When gcc eventually changed the default, it did not lead to
>> wide-spread breakage of code.
>>
> 
> I wouldn't be so sure.
> I have no statistics, but would expect that very significant part of
> Unix-only C programmers, especially grumpy old timers, believes that
> '-fcommon' is the real C and the rest are heresies.
> 

One of the tests the gcc folk (or other interested parties) do before 
releasing a new version of gcc is to do a complete rebuild of some Linux 
distributions - Debian, Red Hat Fedora, and perhaps others.  This can 
lead to reversal of planned changes to default flags in gcc if there is 
significant breakage, or to changes in makefiles or build flags for some 
of the upstream packages if there are only a few packages affected.  So 
a change of the defaults in gcc is a good indication that very few open 
source programs are affected by the change - few enough that changing 
the defaults is worth the effort fixing any conflicting packages.

Of course even Debian does not contain /all/ *nix software, but it 
certainly covers a lot.

I certainly have seen C code with things like "int x;" in header files, 
but it is not that common.  After all, plenty of people will tell you 
how terrible "global variables" are, no matter how they are declared.

A much more common bad style is to have file-scope variables declared as 
"int x;" inside a C file even though they were not intended to be 
externally linked - they should have been declared "static int x;". 
With "-fcommon", if you have coincidentally done that with the same 
identifier name in more than one translation unit, these will be merged 
- potentially leading to all kinds of "fun" bugs.  With "-fno-common", 
you get a link-time error.  This is why "-fno-common" is so important - 
it makes these code errors visible.


But we have more than a few grumpy old timers in this newsgroup - 
perhaps some of them would like to chime in if they believe "-fcommon" 
is how C should be.

(I may be grumpy, and I have grey in my beard and were sandals with 
socks, but I am not yet an "old timer" by the standards of this group - 
so my opinion doesn't count!)