🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #631

Re: Taming The Switch-Statement

#631
From: fir
Date: Wed, 21 Oct 2026 09:19
67 lines
2736 bytes
Lawrence D’Oliveiro pisze:
> t to end each case-sequence in a switch statement with
> a break-statement: put the break at the same indentation level as the
> case-clause as well as the switch-expression. That way, you can scan
> your eye down a single line f

some time ago i was saying what the proper switch should like
(imo, but im not sure if my conclusions are anough to take is a s proven)

case {} case {}  case {} otherwise {}

its indeed sorta needed becouse case in fact are ifs
(not if-elses)  (so some in fact could write

if {} if {} if {} otherwise {}

its the same)

  the problem is you  got no group alse
and here this otherwise need to check all ifs
"or" them and use group else for them

this could be written in few ways, but my case case case otherwise names it
could also do


if {} or if {} or if {} else {}

so either you need logic operators here or predefined constructs like 
otherwise (maybe both)

and that should be included not switch wchich is bad imo


other way is to define distionary more as data construct

dict {
'mental'  {/* 1 */}
'reductionists' {/* 2 */}
'suck' {/* 3 */}
}

then you could use

dict('reductionists')

to yeld to  /* 2 */

this second one parallels to switch keyword


so c switch mixes them both in bad way..they should be spitet and 
upbuild as showed ;c

thats my conclusion as switch topic as far by now ;c











Technical Details
Message-ID: <11ba02r$3pl5h$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-mail
References: <119qf6l$2rmg3$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!.POSTED!not-for-mail
From: fir <profesor.fir@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Wed, 21 Oct 2026 11:19:23 +0200
Organization: A noiseless patient Spider
Lines: 67
Message-ID: <11ba02r$3pl5h$1@dont-email.me>
References: <119qf6l$2rmg3$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 21 Oct 2026 09:19:24 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3986609"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19haWqSL1TaKV7uPuZFRcnLFgRSBNXXvHA="; posting-host="063fb1216b072686dd3449ff2f7e6c5c"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101
 Firefox/140.0 SeaMonkey/2.53.24
Cancel-Lock: sha1:L/DXIJDqi2Cn/kXUscH5L7FdzM0= sha256:gtuLuepHB+JdWxNCi7+6txvof4JL53DfWCuj/jaQJTo=
	sha1:lt6D+OyNs/40M1tPJRAXzsJG7Rs= sha256:n7lVQxkQS1b00wPJ1iqdGFYzxMqi2wziPDWnp7f+TOg=
In-Reply-To: <119qf6l$2rmg3$1@dont-email.me>