Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connectionsPath: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Julio Di Egidio Newsgroups: comp.lang.c Subject: Re: So You Think You Can Const? Date: Wed, 15 Jan 2025 14:22:56 +0100 Organization: A noiseless patient Spider Lines: 55 Message-ID: References: <20250107130809.661@kylheku.com> <87a5c15ob0.fsf@bsb.me.uk> <87ldvk4wu7.fsf@bsb.me.uk> <875xmn4lmy.fsf@bsb.me.uk> <8634hr8muh.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 15 Jan 2025 14:22:57 +0100 (CET) Injection-Info: dont-email.me; posting-host="2563c1350cfe2ddd1cd2f0f3cf044725"; logging-data="3106881"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18501Da3+i52xyKtQhKWr1iU+WImjC9y8U=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:EhyNHqMg+2ArR/MdjbW9Rk2gkt8= Content-Language: en-GB In-Reply-To: Bytes: 3639 On 13/01/2025 04:10, James Kuyper wrote: > On 1/9/25 21:51, Julio Di Egidio wrote: >> On 10/01/2025 03:14, Julio Di Egidio wrote: > ... >>>>>>> Julio Di Egidio writes: >>>>>>> >>>>>>>> On 09/01/2025 02:09, Ben Bacarisse wrote: >>>>>>>> >>>>>>>>> Julio Di Egidio writes: > ... >>>>>>>>>   static AvlTree_t const *AvlTree_node( >>>>>>>>>   void const *pk, AvlTree_t const *pL, AvlTree_t const *pR >>>>>>>>>   ) { >>>>>>>>>   AvlTree_t *pT = malloc(*pT); >>>>>>>>>   if (pT) { >>>>>>>>>   pT->pk = pk; >>>>>>>>>   pT->pL = pL; >>>>>>>>>   pT->pR = pR; >>>>>>>>>   } >>>>>>>>>   return pT; >>>>>>>>>   } >>>>>>>>> I'm not going to "make a case" for this (though I will if you >>>>>>>>> want!) -- I just think it helps to see lots of different styles. >>>>>>>> >>>>>>>> That is *more* error prone, > ... >>> ... check the return value as soon as the function returns a possibly >>> null pointer or an error value is certainly more widely applicable, >>> and quite less error prone, especially if it's >> >> I meant: immediately check the return value and bail out if needed. >> The other approach does not even simplify on the clean-up, by the way... > > The code you're criticizing as more error prone does check the return > value as soon as the function returns, and bails out if needed.It just > bails out through the missing else clause rather than from the if-clause. LOL, the convincing arguments. Tell that to your customer when things start going south: "it is formally equivalent"! > It does requires code to be indented farther than the other approach. I Sure, one level for each checked call, and that's still just the tip of that iceberg: I mean, are you serious or just you too sell bullshit for a living? Not even my worst enemy I would bullshit that way. > have avoided writing code like that for that reason, particularly when > there's a lot of code inside the it statement's controlled blocks -but > not because it's error prone. It's called error prone when it's easy for the programmers to trip on it. Get a real education for a change. -Julio