Article View: comp.lang.c
Article #649Re: Taming The Switch-Statement
From: Blaine
Date: Wed, 21 Oct 2026 15:29
Date: Wed, 21 Oct 2026 15:29
68 lines
3308 bytes
3308 bytes
fir wrote:
> 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
>
Just start using the switch statement. It's useful in very very very
many cases. You'll get the hang of it right away. Next, it doesn't just
test variable type 'int', also notably 'char', among others.
--
Can you strip away so we may start again?
"There’s a switch and they don't
seem authentic or themselves. It
feels like I’m an unnecessary
body and it’s a waste of time to
even be there." -- Grim, playful Blaine.
Technical Details
Message-ID:
<11balon$1uor$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-mailReferences:
<119qf6l$2rmg3$1@dont-email.me> <11ba02r$3pl5h$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: Blaine <cactus_DAC@yahoo.com> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Wed, 21 Oct 2026 09:29:24 -0600 Organization: A noiseless patient Spider Lines: 68 Message-ID: <11balon$1uor$2@dont-email.me> References: <119qf6l$2rmg3$1@dont-email.me> <11ba02r$3pl5h$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 15:29:27 +0000 (UTC) Injection-Info: dont-email.me; logging-data="64283"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hjBVDzGarP/0NWXZA/nB0BIwGZxOa/H8="; posting-host="2fb7fdbc8d4029fe271dd9b6712ddda4" 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:HGGcb7SYCd8zGnHNLHpG4XXGD/I= sha256:prl6e8bduU0Nlb7ywr+HIFuvP0wV08IhHSvnnmkyeiw= sha1:pnYBenSFNrcKw8/tG002rufSeIw= sha256:c5M/PK/jAlT2oMTDMSJbhmziRDN8HqWbifQZPGPMaxw= In-Reply-To: <11ba02r$3pl5h$1@dont-email.me>