Deutsch   English   Français   Italiano  
<20241130190829.00007193@yahoo.com>

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!.POSTED!not-for-mail
From: Michael S <already5chosen@yahoo.com>
Newsgroups: comp.lang.c
Subject: Re: question about linker
Date: Sat, 30 Nov 2024 19:08:29 +0200
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <20241130190829.00007193@yahoo.com>
References: <vi54e9$3ie0o$1@dont-email.me>
	<viaqh0$nm7q$1@dont-email.me>
	<877c8nt255.fsf@nosuchdomain.example.com>
	<viasv4$nm7q$2@dont-email.me>
	<vibr1l$vvjf$1@dont-email.me>
	<vic73f$1205f$1@dont-email.me>
	<20241129142810.00007920@yahoo.com>
	<vicfra$13nl4$1@dont-email.me>
	<20241129161517.000010b8@yahoo.com>
	<vicque$15ium$2@dont-email.me>
	<vid110$16hte$1@dont-email.me>
	<87mshhsrr0.fsf@nosuchdomain.example.com>
	<vidd2a$18k9j$1@dont-email.me>
	<8734j9sj0f.fsf@nosuchdomain.example.com>
	<vidnp3$1ovvm$2@paganini.bofh.team>
	<vidqbb$1b5qv$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 30 Nov 2024 18:08:35 +0100 (CET)
Injection-Info: dont-email.me; posting-host="50086155b7b9a9319623e2a87e2f2f0f";
	logging-data="1939611"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX186bClLvYRgpKNVusbAc1zJv5IW6XkDUv8="
Cancel-Lock: sha1:CNZtYQLKNQTA2Y9ow8gY2Gpsl4Y=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
Bytes: 3048

On Fri, 29 Nov 2024 20:38:51 -0500
James Kuyper <jameskuyper@alumni.caltech.edu> wrote:

> On 11/29/24 19:55, Waldek Hebisch wrote:
> ...
> > Hmm, in well-written code static functions are likely to be a
> > majority.  Some people prefer to declare all functions and
> > put declarations of static functions in the same file as the
> > functions itself.  Conseqently, function declarations are not
> > rare in such code.  Do you consider it well-written?  
> 
> I wouldn't go so far as to say that it's poorly written, but I don't
> like the unnecessary redundancy of that approach. Whenever possible, I
> prefer to let each static function's definition serve as it's only
> declaration. This isn't possible, for instance, if you have a pair of
> mutually recursive functions.
> 
> The redundancy between a header file's function declaration and the
> corresponding function definition is necessary, given the way that C
> works. Avoiding that is one of the reasons I like declaring static
> functions, where appropriate.

Top-down-minded people don't like details textually preceding "big
picture".

[O.T.]
Better solution would be if static function definition anywhere in the
file serves like declaration (prototype) for the whole file, including
preceding part. We are long past the time where single-pass compiler
was a legit argument against such arrangement. Nowadays the only
possible counter argument would be breaking existing code. But I don't
see how such change breaks anything.