🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #152

Re: Taming The Switch-Statement

#152
From: Keith Thompson
Date: Sat, 10 Oct 2026 22:32
22 lines
2397 bytes
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> On 2026-10-10 22:03, Michael S wrote:
>> The cases where I want to break out of the loop from the switch in
>> the
>> body of the loop are very common.
>
> Ah, so you'd have needed something like Kornshell's 'break 2' to leave
> more than one level. - I suppose, you needed to used a 'goto' instead
> (and avoid the 'break' completely for those cases).

Something like that, sure, but please not that.

Specifying the *number* of levels to break or continue is IMHO
horrible.  "break N" makes me count things so the computer doesn't
have to.

There are proposals, and precedents in other languages, for *named*
loops, and I'd like to see that in a future C.

-- 
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: <11aeee0$24k8m$1@kst.eternal-september.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!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> <11ae7eb$cjlv$6@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!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: Sat, 10 Oct 2026 15:32:32 -0700
Organization: None to speak of
Lines: 22
Message-ID: <11aeee0$24k8m$1@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> <11ae7eb$cjlv$6@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Sat, 10 Oct 2026 22:32:33 +0000 (UTC)
Injection-Info: kst.eternal-september.org;
	logging-data="2248982"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/q4xneEohkMzuL/73KE550"; posting-host="29efadadb268dc6914862df94b2a05d4"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:l2z+pssloJu23fnKLFaFZQb9ch0= sha256:I6NgNvA8wnc2pMRHM6+S+7YrWzb9s9BXaWVGK1GJbc4=
	sha1:C2sTdNzvubWlOUUYRSZIVgDBb84= sha256:MT2pWAs3QhqHM5aVj1q/AKET0z+lt6JRku82goSEjAg=