Sujet : Re: C23 thoughts and opinions - why so conservative?
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.cDate : 24. May 2024, 09:42:24
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240524114224.000076e2@yahoo.com>
References : 1 2 3 4 5 6
User-Agent : Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
On Fri, 24 May 2024 06:38:18 +0100
Malcolm McLean <
malcolm.arthur.mclean@gmail.com> wrote:
On 24/05/2024 02:06, Lawrence D'Oliveiro wrote:
On Fri, 24 May 2024 00:34:24 +0300, Michael S wrote:
On Thu, 23 May 2024 22:10:22 +0200 David Brown
<david.brown@hesbynett.no> wrote:
What program control construct would you like?
Ability to break from nested loops.
At least 90% of the time, when I want to exit from an inner loop in
C, there will be some kind of cleanup I need to do in the outer
loop before that can exit too. So the ability to jump straight out
will rarely be used.
goto gives you the functionality you require.
>
Sure, me too. Because that's what I have.
If they hadn't given me {, }, else, while, for, and do then I would
use goto to simulate all those as well. It gives functionality I
require, don't it?
I usually use goto for handling malloc() failures. So if an
allocation fails within a deeply nested loop, I will jump to code at
the end of the function, free up amy half-constructed objects, and
return an error condition.
I do similar thing too, but that's just a habit that I can't overcome.
It has no practical sense in environments that I work today. I could
just as well return immediately, without cleaning up, it would have
zero practical difference except that my code would be shorter and will
look cleaner.