Article View: comp.lang.c
Article #216Re: Taming The Switch-Statement
From: bart
Date: Sun, 11 Oct 2026 13:51
Date: Sun, 11 Oct 2026 13:51
42 lines
3187 bytes
3187 bytes
On 11/10/2026 14:13, Tim Rentsch wrote: > bart <bc@freeuk.com> writes: > >> 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. > > It doesn't surprise me that they exist. What surprises me is > that they are common, in code written by someone I consider a > competent programmer. I don't care about what idiotic things > are done by people who aren't competent programmers. > > You might want to think about the deeper meaning of that last > sentence. You might also think about the deeper meaning of my comments. You don't take a problem feature of a language design and brush it under the carpet. Then, when questioned, suggest that it's very rarely used. Or when it is used, that they shouldn't using it because everyone should be as clever as you at writing convoluted code: Look how clever I am, I've never needed to use '(loop) break' or 'goto' ever. (See, I even had to qualify that 'break' because 'switch' stupidly uses the same keyword.) And you're ignoring my point: inside a loop is a conditional break. But as the language is now, you must use if-else for that condition and not switch. That is a flaw.
Technical Details
Message-ID:
<11ag49c$2mal9$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> <11afvqt$2kloc$1@dont-email.me> <86zewkidn4.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 14:51:41 +0100 Organization: A noiseless patient Spider Lines: 42 Message-ID: <11ag49c$2mal9$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> <11afvqt$2kloc$1@dont-email.me> <86zewkidn4.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 13:51:40 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2828969"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ee+y7Td/CD+10AyB1t3Y+"; posting-host="bb4c63ed27c528dcfc498e66a186f254" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:r7jjSW4ZtAL+/Jt+CNttwAt0sBI= sha256:XlTPLC+5JWJ0ikXaWabxkjQ6u0cef6Fosna29c18oH0= sha1:hq5m7QngGaFo5C01hDNQnoTWdQE= sha256:hp6+c0Lr2pgF5fIkfrWuWrH0tb6aZk0BIO/WFAgPIYA= In-Reply-To: <86zewkidn4.fsf@linuxsc.com> Content-Language: en-GB