Path: ...!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:11:09 +0100 Organization: A noiseless patient Spider Lines: 84 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: 7bit Injection-Date: Wed, 15 Jan 2025 14:11:10 +0100 (CET) Injection-Info: dont-email.me; posting-host="2563c1350cfe2ddd1cd2f0f3cf044725"; logging-data="3106880"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jNV89RfalJn5mENCWe9QkO6eA/eqVXq8=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:/3kP/W1/cSHKpeQa0N2Nj6rUA3E= In-Reply-To: <8634hr8muh.fsf@linuxsc.com> Content-Language: en-GB Bytes: 4216 On 10/01/2025 02:43, Tim Rentsch wrote: > Julio Di Egidio writes: > >> On 10/01/2025 00:37, Julio Di Egidio wrote: >> >>> On 10/01/2025 00:23, Ben Bacarisse 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; >>>>>>> >>>>>>> pT = malloc(sizeof(AvlTree_t)); >>>>>>> >>>>>>> if (!pT) { >>>>>>> return NULL; >>>>>>> } >>>>>>> >>>>>>> pT->pk = pk; >>>>>>> pT->pL = pL; >>>>>>> pT->pR = pR; >>>>>>> >>>>>>> return pT; >>>>>>> } >>>>>> >>>>>> Just on a side issue, I prefer to make tests like this positive >>>>>> so I'd write: >>>>>> 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, >>>> >>>> I would be happy for you to expand on why you say that. >>>> >>>>> all the more so if it's not a 5 liner... >>> >>> There is no such thing as expanding 40 years of professional >>> experience in software engineering and programming and doing it >>> properly since day one: just think about that code and what I said >>> for what it's worth, in particular I haven't mentioned 5 liners by >>> chance, things are quite more complicated not in vitro. >>> >>> And please do not hold a grudge about that: it's not me who was >>> trying to say how to write code... ;) >> >> BTW, I hadn't mention it, but have you noticed the second one is >> misindented? Between me and you, I can tell how long a piece of >> code will take to break when in production by just looking at >> it... A lot of fun. :) > > The indentation was correct in Ben's original posting. > > The misindentation first appeared in your followup to that > posting, where the quoted portion had been changed to remove a > blank line and over-indent the if(). You other blithering idiot: Ben's initial code had *a missed blank line*, and that was the benningg of my pointing out what a stupid fuck thgat was: and the long run for that. You guys just cannot even read but you did manage to get the bottom of it, a pile of lurid shit... BTW, I do am having troubles finding some of Ben Bacarisse's initial pieces of trolling shit: there is indeed something strange going on around here.,. -Julio