Article View: comp.lang.c
Article #211Re: Taming The Switch-Statement
From: bart
Date: Sun, 11 Oct 2026 12:35
Date: Sun, 11 Oct 2026 12:35
28 lines
2416 bytes
2416 bytes
On 11/10/2026 12:26, Tim Rentsch wrote:
> Michael S <already5chosen@yahoo.com> writes:
>
>> The cases where I want to break out of the loop from the switch in
>> the body of the loop are very common.
>
> That surprises me. Can you post a representative example (and
> ideally not overly long)?
An example shouldn't be necessary. It is enough to know that loop-breaks
exist and are used.
Then, whether break works here:
while (cond) {
....
break;
....
}
shouldn't need to depend on whether that break happens to be inside a
switch statement.
Maybe it is within an if-else chain, but at some point it is refactored
into a switch statement. Now it no long does what is expected, and in
fact using break to quit the loop from inside switch becomes impossible.
Technical Details
Message-ID:
<11afvqt$2kloc$1@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-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> <864iesjx6e.fsf@linuxsc.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: bart <bc@freeuk.com> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Sun, 11 Oct 2026 13:35:39 +0100 Organization: A noiseless patient Spider Lines: 28 Message-ID: <11afvqt$2kloc$1@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> <864iesjx6e.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 11 Oct 2026 12:35:42 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2774796"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bTx3d8/rn6z8KZKZJJlrB"; posting-host="bb4c63ed27c528dcfc498e66a186f254" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:92tWUnlUyrKNS3EQV+zTzJbPJTo= sha256:m7+MFjv3IiVPsQib1eEvdaBR3lKThn0NhILyFYoW3Fk= sha1:U+ESkrn6N8sCRIxQd2rSrrxds4s= sha256:WbbGZ/DNBQKp5rhw6O/KaNfYBqLteD9LJlInrDVztHI= In-Reply-To: <864iesjx6e.fsf@linuxsc.com> Content-Language: en-GB