🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #508

Re: Taming The Switch-Statement

#508
From: David Brown
Date: Sun, 18 Oct 2026 14:52
41 lines
3905 bytes
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 (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.

>> 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.  But of course there is no requirement to /use/ the 
new feature if you don't like it.  (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: <11b2mf1$16mof$2@dont-email.me>
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
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>

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: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Sun, 18 Oct 2026 16:52:17 +0200
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <11b2mf1$16mof$2@dont-email.me>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 18 Oct 2026 14:52:17 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1268495"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18CeMA4l2fkjo6iPAfPbHHgf2Yt4/morWU="; posting-host="a272f2752d0a4376a695806f42b83d2a"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:KFs4InJp8pvPqLQ/qvk5vKSumRQ= sha256:cy5UH4ShvnnwoYrkVnU/UePYgmJyIOGUm10Z8HMpgwU=
	sha1:YCMJoMq9bltnGmQdy9plkbHF17A= sha256:16jxCfEgiC8UWNpTdXQt2FveKpgYjCN4dCTdFaN1wC0=
Content-Language: en-GB
In-Reply-To: <20261018171339.00005308@yahoo.com>