Sujet : Re: C23 thoughts and opinions - why so conservative?
De : malcolm.arthur.mclean (at) *nospam* gmail.com (Malcolm McLean)
Groupes : comp.lang.cDate : 24. May 2024, 06:38:18
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v2p94a$26km6$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
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.
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.
-- Check out Basic Algorithms and my other books:https://www.lulu.com/spotlight/bgy1mm