🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #290

Re: Taming The Switch-Statement

#290
From: Janis Papanagnou
Date: Mon, 12 Oct 2026 20:56
48 lines
3290 bytes
On 2026-10-12 21:52, Scott Lurndal wrote:
> bart <bc@freeuk.com> writes:
>> On 12/10/2026 18:58, Dan Cross wrote:
>>> In article <11ainqf$3kkvd$1@dont-email.me>, bart  <bc@freeuk.com> wrote:
>>
> 
>> This is my first example expressed in C (note those first three args are
>> passed by reference):
>>
>>      while (pmtype = nextcmdparam(&paramno, &name, &value, "m") {
>>          switch (pmtype)
>>          case pm_option: ...; break;
>>          case pm_sourcefile:
>>              if (passlevel == run_pass || passlevel == runpcl_pass) {
>>                  break;
> 
> Aside from the incorrect syntax, it's really difficult to
> determine your intent from this code fragment.

Well, to me it's clear what he meant by this code.

But it's unimportant since it doesn't add anything to what he has
repeated countless times; that in a loop()-switch() structure the
inner 'break' in the 'switch' would not leave the loop().

Such code exists in various forms, it's not something "strange".
It's also no problem that couldn't be addressed by other patterns.
(But he refuses to use them, or he's just blind to not see them.)

A loop()-specific 'break' would serve him (if he wants to abstain
from 'goto', or is refusing from doing just a slight code change).

(Maybe if he'd just hold his breath long enough something would
happen?)

> 
> It's likely that folks here could provide more idiomatic
> C if you described the problem you're attempting to solve
> rather than providing an incomplete and incorrect code
> fragment.

I think it's sufficiently idiomatic. And I don't think that he could
provide anything where the answers would pass though the mental block
he obviously has. The thread was (by content) dead already very soon.
IMO it makes no sense to continue arguing with him.

Janis
Technical Details
Message-ID: <11ajhhk$286mm$6@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> <11agils$2s3tg$1@dont-email.me> <11ahpqi$38ir0$2@dont-email.me> <11ainqf$3kkvd$1@dont-email.me> <11aj73v$c2u$1@reader2.panix.com> <11ajcv8$3u33s$1@dont-email.me> <GTazS.183760$ygUb.176068@fx23.iad>

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: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Mon, 12 Oct 2026 22:56:20 +0200
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <11ajhhk$286mm$6@dont-email.me>
References: <119qf6l$2rmg3$1@dont-email.me> <11agils$2s3tg$1@dont-email.me>
 <11ahpqi$38ir0$2@dont-email.me> <11ainqf$3kkvd$1@dont-email.me>
 <11aj73v$c2u$1@reader2.panix.com> <11ajcv8$3u33s$1@dont-email.me>
 <GTazS.183760$ygUb.176068@fx23.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 12 Oct 2026 20:56:21 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2366166"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18iPCIwqwxWuexaRD7344S8"; posting-host="5867007c58404d9809ba59751570602e"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:aKKvfnqHRcs70qATlGr8+dMGi/0= sha256:giIPOmAMmhTbQ+Gxi1QT43YtyPgaju73Nv4NixRJXbc=
	sha1:A98Z6O2j4mmu8d2BKQZglQvhcuk= sha256:Bjt3M8y0oio6BKtFHM3/u6trRruan2E2KQj6MdK8oj8=
Content-Language: en-US
In-Reply-To: <GTazS.183760$ygUb.176068@fx23.iad>