Sujet : goto considered helpful (Was: question about linker)
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.cDate : 12. Dec 2024, 13:44:54
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20241212144454.00003b83@yahoo.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
User-Agent : Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
On Wed, 11 Dec 2024 17:27:53 -0800
Keith Thompson <Keith.S.Thompson+
u@gmail.com> wrote:
bart <bc@freeuk.com> writes:
[...]
My experience of multi-level break is that there are two main
use-cases:
>
* Used in the current loop only (not necessarily the innermost to
an observer). This is the most common
>
* Used to exit the outermost loop
>
So to support these, named or even numbered loops are not
necessary. (Eg. I use 'exit' or 'exit all'.)
I would oppose a change to C that only applied to innermost and
outermost loops. For one thing, I'm not aware of any other language
that does this (except perhaps your unnamed one). For another,
it's easy enough to define a feature that handles any arbitrary
nesting levels, by applying names (labels) to loops.
>
The better solution is education.
Convince teachers in unis and colleges that goto is *not* considered
harmful for this particular use case. Convince them to teach that
attempts to avoid goto [for this particular use case] are really
considered harmful. If you don't believe in authority of yourself then
ask for help from somebody famous that share this view. I would guess
that nearly all famous C programmers share it.