🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #251

Re: Taming The Switch-Statement

#251
From: Keith Thompson
Date: Sun, 11 Oct 2026 23:29
51 lines
3646 bytes
bart <bc@freeuk.com> writes:
> On 11/10/2026 22:28, Keith Thompson wrote:
[...]
> You're missing the undercurrent, which is a tone of disapproval and
> disbelief.

I was responding to what you wrote, not to some "undercurrent".

Missing it?  I'm practically drowning in it.

You're missing the fact that the problems you keep complaining
about are things that (essentially) everyone was already aware of.

You seem unable to understand that the rest of aren't as angry about
fallthrough as you are, and that we might have valid reasons for
not being angry about it.  You seem to think that anyone who is not
outraged that C hasn't added a version of switch that doesn't have
fallthrough simply doesn't understand what you're saying.

[...]

>> Breaking out of an outer loop from within an inner loop is just
>> as much of a problem.
>
> A less common one but when it happens it will be an actual problem and
> not an artificial one.
>
>>  "break NAME;" proposed for C2y, would solve
>> both problems.  (I just found out that recent versions of gcc and
>> clang support this as an extension or with "-std=c2y".)

[...]

> Does this also fix the break-out-of-a-loop-from-inside-switch issue?

It fixes it in the sense that both loops and switch statements can be
named, and a break or continue can optionally refer to the name of the
targeted loop or switch statement.  Of course it doesn't automatically
fix existing code.

> In that case just 'break for/while' might do!

That would work for a "for" within a "while", or a "while" within
a "for", but not for a "while" within a "while" or a "for" within
a "for".

There is ample precedent for named loops in other languages.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Technical Details
Message-ID: <11ah640$329bt$5@kst.eternal-september.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!kst.eternal-september.org!.POSTED!not-for-mail
References: <119qf6l$2rmg3$1@dont-email.me> <11ac0mi$19kfd$1@dont-email.me> <11ac2jv$1a84t$1@dont-email.me> <11ac783$1bkuo$1@kst.eternal-september.org> <11ad5eq$1l8hg$1@dont-email.me> <11ad9fg$cjm0$4@dont-email.me> <11addhr$1oakb$1@dont-email.me> <11aduuk$cjlv$1@dont-email.me> <20261010220212.000063fd@yahoo.com> <11ae56o$cjlv$4@dont-email.me> <20261010230355.00005189@yahoo.com> <864iesjx6e.fsf@linuxsc.com> <11afvqt$2kloc$1@dont-email.me> <11ag37o$2ln0a$1@dont-email.me> <11agbsh$2pbk7$1@dont-email.me> <11aggaq$2qqh9$1@dont-email.me> <11agils$2s3tg$1@dont-email.me> <11agv1t$30q22$2@kst.eternal-september.org> <11ah12b$320sj$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!kst.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Sun, 11 Oct 2026 16:29:04 -0700
Organization: None to speak of
Lines: 51
Message-ID: <11ah640$329bt$5@kst.eternal-september.org>
References: <119qf6l$2rmg3$1@dont-email.me> <11ac0mi$19kfd$1@dont-email.me>
	<11ac2jv$1a84t$1@dont-email.me>
	<11ac783$1bkuo$1@kst.eternal-september.org>
	<11ad5eq$1l8hg$1@dont-email.me> <11ad9fg$cjm0$4@dont-email.me>
	<11addhr$1oakb$1@dont-email.me> <11aduuk$cjlv$1@dont-email.me>
	<20261010220212.000063fd@yahoo.com> <11ae56o$cjlv$4@dont-email.me>
	<20261010230355.00005189@yahoo.com> <864iesjx6e.fsf@linuxsc.com>
	<11afvqt$2kloc$1@dont-email.me> <11ag37o$2ln0a$1@dont-email.me>
	<11agbsh$2pbk7$1@dont-email.me> <11aggaq$2qqh9$1@dont-email.me>
	<11agils$2s3tg$1@dont-email.me>
	<11agv1t$30q22$2@kst.eternal-september.org>
	<11ah12b$320sj$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Sun, 11 Oct 2026 23:29:05 +0000 (UTC)
Injection-Info: kst.eternal-september.org;
	logging-data="3220861"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+vhz/8qb/j+NFyC4WQ1Xej"; posting-host="50698cca2518b68a86663845e71c144a"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:K4oVGspuVFVWrM+79jOISy3DPcA= sha256:ndhmTGRuOZ0rPDy78yyVaNSJpX2a443SbveyvP4BIro=
	sha1:Gj/qX9PbK7giiC0UBQxh4q6QCBo= sha256:1oZ9XuKuGCqBfJv/p1qJs8xA8wN7oSslTffY1zPtUH4=