Article View: comp.lang.c
Article #511Re: Taming The Switch-Statement
From: Michael S
Date: Sun, 18 Oct 2026 15:16
Date: Sun, 18 Oct 2026 15:16
70 lines
4789 bytes
4789 bytes
On Sun, 18 Oct 2026 16:52:17 +0200
David Brown <david.brown@hesbynett.no> wrote:
> On 18/10/2026 16:13, Michael S wrote:
> > On Sun, 18 Oct 2026 14:34:28 +0200
> > Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
> >
> >> On 2026-10-18 14:09, David Brown wrote:
> >>>
> >>> [...] (I don't know why N3377 proposed "do { } while NAME ( )"
> >>> rather than "do NAME { } while ( )". )
> >>
> >> Oh! - I can only think that it would then be (sort of) "consistent"
> >> with the place of the label attacked in a 'while' loop; i.e. behind
> >> the 'while' keyword. - It's inconsistent in another interpretation,
> >> though; and I'd certainly have favored the latter form, to have the
> >> label consistently attached at the loop-entry keyword.
> >
> > I'd prefer label consistently attached to the loop-exit keyword.
> > Unfortunately, for() and while() loops have no such keyword.
> >
>
> That would help for switch inside a loop, or loop inside a switch,
> but do nothing for loop inside a loop or switch inside a switch. I
> don't think anyone involved in the development of the language has
> seriously considered making a solution that only handles the first
> two cases, and not the second two
Pay attention that 4 patterns are not equal. The second case
(breaking from loop to outside of containing switch) hardly happens.
> (to say nothing of three or more
> nesting layers). "break_switch" and "break_loop" style solutions have
> been mentioned and quickly dismissed, along with the "break <depth>"
> options.
>
It does not look like you understood what I wrote.
All I wanted to say is that I prefer label to be located at where the
break goes. Or near this point. Within frame of current C syntax, I
don't see how to achieve it, except for do-while. But it does not
change the fact that I find it desirable.
> >> We'll see what they finally decide (unless it's already clear; I'm
> >> not sure about the factual weight of the "proposal")...
> >>
> >
> > I tend to agree with Tim (if I correctly understood him): a.t.m. the
> > best outcome would be proposal scrapped completely.
> >
>
> The proposal has been accepted - it is coming to C and C++, whatever
> you or Tim may think.
Nothing is set in stone until the standard released. But you are very
likely right. Which does not make me happier.
> But of course there is no requirement to /use/
> the new feature if you don't like it.
But others will use it and I'd have to read and understand their code.
> (I don't expect to use it
> significantly myself - I just don't seem to write code in a way that
> could take advantage of it.)
>
Technical Details
Message-ID:
<20261018181623.00007978@yahoo.com>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!.POSTED!not-for-mailReferences:
<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> <11aeee0$24k8m$1@kst.eternal-september.org> <11aer17$286ml$2@dont-email.me> <11aeusp$29hmu$2@kst.eternal-september.org> <86mrsdpcgp.fsf@linuxsc.com> <11au6pr$3mdne$1@kst.eternal-september.org> <11auc0s$206gh$3@dont-email.me> <11b285v$121v2$2@dont-email.me> <11b293j$12jfa$1@dont-email.me> <11b2cuh$141vj$1@dont-email.me> <11b2eck$3pvd9$1@dont-email.me> <20261018171339.00005308@yahoo.com> <11b2mf1$16mof$2@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!.POSTED!not-for-mail From: Michael S <already5chosen@yahoo.com> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Sun, 18 Oct 2026 18:16:23 +0300 Organization: A noiseless patient Spider Lines: 70 Message-ID: <20261018181623.00007978@yahoo.com> 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> <11aeee0$24k8m$1@kst.eternal-september.org> <11aer17$286ml$2@dont-email.me> <11aeusp$29hmu$2@kst.eternal-september.org> <86mrsdpcgp.fsf@linuxsc.com> <11au6pr$3mdne$1@kst.eternal-september.org> <11auc0s$206gh$3@dont-email.me> <11b285v$121v2$2@dont-email.me> <11b293j$12jfa$1@dont-email.me> <11b2cuh$141vj$1@dont-email.me> <11b2eck$3pvd9$1@dont-email.me> <20261018171339.00005308@yahoo.com> <11b2mf1$16mof$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Date: Sun, 18 Oct 2026 15:16:32 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1262206"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+LfUOXfear1pkTNNHF7zuTEqhmzgGelxE="; posting-host="f3ba9e4a06adc8c40e079351cfd7a0db" Cancel-Lock: sha1:XSSPBTHRnf1hjcWRqoyCFGwy7OA= sha256:50DQ3+oZ8nvBHmXwkWGnvrD7XBu+rpAk55sMefvVoVQ= sha1:KKLOMinSHiBTI0FL8C6Sh9UPits= sha256:+sBEQyvJRzrBks+zqYbI2lXizUhyktPHSM+IpepCenw= X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)