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, 8 Dec 2024 11:52:58 +0100 Organization: A noiseless patient Spider Lines: 36 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 08 Dec 2024 11:52:59 +0100 (CET) Injection-Info: dont-email.me; posting-host="90ad15a344bc4dfe05e7ef38d439f736"; logging-data="3941839"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Boy3ZpfhI3gNPtaAcBLfmMBgu66FvrNk=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:pWmeLsXmquW0SHtrs0q1o73NdL4= Content-Language: en-GB In-Reply-To: Bytes: 3399 On 07/12/2024 22:18, Bart wrote: > On 07/12/2024 21:00, David Brown wrote: > >> > > You mean that /real/ example where a function needed a type written 6 > times instead of once? OK. > > I'd be curious about how you'd write such a function; maybe all your > functions only have one parameter, or they are always of mixed types. Having so many parameters in a function is a sign of a bad interface design - the more parameters, the poorer the design. Occasionally having 6 parameters might be the best choice in a particular case, but it is going to be rare - most functions have far fewer. And it's okay if things are a bit awkward or harder to write for something that should be rare, and is rare in practice. The problem is not so much when defining or declaring the function - it is when /using/ the function. C does not have named arguments, and it is extremely easy for code calling a function of many parameters to mix them up (especially if they are the same type). I'd have been quite happy if C had a syntax along the lines of int foo(int a, b, c, double x, y, z); for declaring functions. It can't quite follow the same pattern as for declarations of variables (because then you'd need a semicolon after the "c" above), but it would be close. But C doesn't have a syntax like that, and the syntax it has is rarely an issue for anyone.