🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #571

Re: Taming The Switch-Statement

#571
From: Keith Thompson
Date: Mon, 19 Oct 2026 22:28
33 lines
3333 bytes
David Brown <david.brown@hesbynett.no> writes:
> On 19/10/2026 12:50, Keith Thompson wrote:
[...]
>> The odd scoping rules for labels don't bother me either.  They mean
>> you can't have two loops or switch statements with the same name in
>> the same function.  I can barely imagine that being inconvenient.
>
> I can imagine that being a bit inconvenient in some cases, but I think
> the proposal in N3658 would simply and cleanly fix that.
[...]

*If* the fact that labels (which are now also loop/switch names)
follow strange scope rules is a real problem, N3658 is probably
the best practical solution.  I'm slightly uncomfortable with the
idea of an entity's scope depending on how it's used, not just how
it's defined.  I think it introduces a complication to the language
without much real benefit.

But cleaner solutions are impractical.

IMHO the only really clean solution would be to make labels and
loop/switch names distinct, keep the existing scoping rules for
labels, and use more normal scoping rules for loop/switch names.
And if the "while NAME (...)" proposal were accepted, that's probably
how it should work.  (But I prefer having the name as a prefix of the
loop or switch statement.)

If N3658 were adopted, it wouldn't bother me much.  I just don't
think it's necessary.

-- 
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: <11b65hn$2fcat$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> <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> <20261018181623.00007978@yahoo.com> <11b347h$1cn63$1@dont-email.me> <20261018223859.000031d3@yahoo.com> <11b4n4s$1q18k$1@dont-email.me> <11b4smj$1vt4q$1@kst.eternal-september.org> <11b4t5k$1q18k$3@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: Mon, 19 Oct 2026 15:28:07 -0700
Organization: None to speak of
Lines: 33
Message-ID: <11b65hn$2fcat$1@kst.eternal-september.org>
References: <119qf6l$2rmg3$1@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> <20261018181623.00007978@yahoo.com>
	<11b347h$1cn63$1@dont-email.me> <20261018223859.000031d3@yahoo.com>
	<11b4n4s$1q18k$1@dont-email.me>
	<11b4smj$1vt4q$1@kst.eternal-september.org>
	<11b4t5k$1q18k$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Mon, 19 Oct 2026 22:28:08 +0000 (UTC)
Injection-Info: kst.eternal-september.org;
	logging-data="2601309"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19q2hv1+3t464ae1o/ipeSY"; posting-host="9660475a9289184964a5dc25cbc4aed9"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:qPPViRK1Q/lKps/J3ClEWwzDVis= sha256:UzWLMyndIEcSlhArGSQK3Hj+Gn93msE5T/QV8mNd10A=
	sha1:1HCStFDV/o33KDfE8yNvR9+afTU= sha256:4rWSSlpjfYi29Q2WiL+8PsuGKp+EierpG65qLSjb+cg=