🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #300

Re: Taming The Switch-Statement

#300
From: Keith Thompson
Date: Mon, 12 Oct 2026 23:29
21 lines
2196 bytes
bart <bc@freeuk.com> writes:
[...]
> So 99% of programmers have to suffer needing to pointlessly write
> 'break' everywhere, rather than the 1% having to write 'fallthru'.

We're not suffering.

Speaking for myself, I had to learn *once*, several decades ago,
that each case needs to end with "break;" (unless I want fallthrough
behavior).  As I've mentioned here before, I pretend that the "break;"
is part of the syntax of a switch statement, while being aware that
it really isn't.

It's easy, and it doesn't hurt a bit.  I'll bet it would be easy
for you if (a) you regularly wrote C code (I don't know how often
you do) and (b) you didn't go out of your way to suffer on other
people's behalf.

-- 
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: <11ajqhc$28f2$2@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> <11ah16h$320sj$2@dont-email.me> <11ahqpu$38ir0$3@dont-email.me> <11aidi3$3gbu4$1@dont-email.me> <11aj5nt$t7t$1@reader2.panix.com> <5W9zS.161421$98z8.84067@fx33.iad> <11ajaa1$3ssqg$1@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, 12 Oct 2026 16:29:48 -0700
Organization: None to speak of
Lines: 21
Message-ID: <11ajqhc$28f2$2@kst.eternal-september.org>
References: <119qf6l$2rmg3$1@dont-email.me> <11ah16h$320sj$2@dont-email.me>
	<11ahqpu$38ir0$3@dont-email.me> <11aidi3$3gbu4$1@dont-email.me>
	<11aj5nt$t7t$1@reader2.panix.com> <5W9zS.161421$98z8.84067@fx33.iad>
	<11ajaa1$3ssqg$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Mon, 12 Oct 2026 23:29:49 +0000 (UTC)
Injection-Info: kst.eternal-september.org;
	logging-data="74210"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/pVyps8hY0nj5OAoZnnY7l"; posting-host="95ffa552a4e78b727a4601858208ae3a"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:pBqpgfNhHkoIHOOYOlYOKk7D26k= sha256:Ittf5NJaj665zY6nlmzca9DTzf0qv3ungPFZRRcL5E0=
	sha1:JBAS6dqUcJuYoLKBd+nEd8ddUrk= sha256:e0ueOdT4Hq2NX9XQyScziFfaYpXi+hfettr9kkKMalw=