Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: David Brown Newsgroups: comp.lang.c Subject: Re: question about linker Date: Sun, 1 Dec 2024 19:33:08 +0100 Organization: A noiseless patient Spider Lines: 44 Message-ID: References: <87plmfu2ub.fsf@nosuchdomain.example.com> <87frnbt9jn.fsf@nosuchdomain.example.com> <877c8nt255.fsf@nosuchdomain.example.com> <20241129142810.00007920@yahoo.com> <20241129161517.000010b8@yahoo.com> <87mshhsrr0.fsf@nosuchdomain.example.com> <8734j9sj0f.fsf@nosuchdomain.example.com> <20241201185740.00004c30@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 01 Dec 2024 19:33:12 +0100 (CET) Injection-Info: dont-email.me; posting-host="cb92292cff9a7aed5107a3020cf78af5"; logging-data="2846089"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+VsgUD3/tgjox1CB/PGUr7MdSHKvY5XY=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:0ZAfItcGkUQtbTPxJL6Cjmu/xUY= Content-Language: en-GB In-Reply-To: <20241201185740.00004c30@yahoo.com> Bytes: 3855 On 01/12/2024 17:57, Michael S wrote: > On Sun, 1 Dec 2024 15:34:04 +0100 > David Brown wrote: >> >> I can see some advantages in a language being happy with any order of >> function definition, without requiring forward declarations to use a >> function before it is defined. But C is not like that, and I cannot >> honestly say it bothers me one way or the other. And apparently, it >> does not particularly bother many people - there is, I think, no >> serious impediment or backwards compatibility issue that would >> prevent C being changed in this way. Yet no one has felt the need >> for it - at least not strongly enough to fight for it going in the >> standard or being a common compiler extension. >> >> >> > > I think, arguing in favor of such change would be easier on top of > the changes made in C23. > Before C23 there were, as you put it "no serious impediment or > backwards compatibility issue". After C23 we could more categorical > claim that there are no new issues. > Does that mean there was something that you think was allowed in C before C23, but not after C23, that would potentially be a problem here? What, specifically, are you thinking of? The changes in declarations in C23, AFAIK, are that "void foo();" now means the same as "void foo(void);", and that in general non-prototype function declarations are no longer allowed. (That is a good change, of course - 30 years late, but still welcome.) But I can't think of a situation where code that is correct under the current "declare before using" rule would no longer be correct if "declare before or after" were allowed at the file-scope level. Maybe you could construct something by playing silly-buggers with macros to re-define identifiers at different points in the code. I can't say I've thought much about the consequences of such a rule change - it doesn't seem a realistic change to me, and I have no problem with the current rule. So it's quite possible that I've missed something.