Article View: comp.lang.c
Article #806Re: Taming The Switch-Statement
From: Janis Papanagnou
Date: Mon, 26 Oct 2026 18:39
Date: Mon, 26 Oct 2026 18:39
51 lines
3049 bytes
3049 bytes
On 2026-10-26 17:42, bartc wrote:
> On 26/10/2026 16:37, fir wrote:
>> bartc pisze:
>>> On 26/10/2026 16:03, fir wrote:
>>>> bartc pisze:
>>>>> On 26/10/2026 12:20, fir wrote:
>>>>>> bartc pisze:
>>>>>>> On 26/10/2026 12:07, fir wrote:
>>>>>>>> fir pisze:
>>>>>>>>> if {} or if {} or if {} else {}
[...]
>>>>>>>> if () {}
>>>>>>>> or if () {}
>>>>>>>> or if() {}
>>>>>>>> else {}
[...]
>>>>> #define or else
>>>>>
>>>>> for (int i=0; i<=5; ++i)
>>>>> if (i==1) {puts("One");}
>>>>> or if (i==2) {puts("Two");}
>>>>> or if (i==3) {puts("Three");}
>>>>> else {puts("Other");}
[...]
>>>> case x%2==0 //2 4 6 8 10 12
>>>> case x%3==0 //3 6 9 12
>>>> default // 1 5 7 11 13
[...]
>>> if (0)
>>> else if (x%2==0) {}
>>> else if (x%3==0) {}
[...]
> if (x%2==0) {}
> if (x%3==0) {}
>
> Here it is clear they are non-exclusive.
>
> You're also in luck: this is exactly how C works now!
I'm not sure what fir actually wants; I cannot decipher his writings
quoted by you. But, given that he not yet seems satisfied with your
replies and suggestions, could it, by any chance, be that what he
wants is some non-deterministic construct like Dijkstra's Guards?
I.e., that with two guards 'x%2==0' and 'x%3==0' and an input of "6"
only _one_ of the two gets _arbitrarily_ triggered?
(Otherwise his post appears quite pointless to me.)
Janis
Technical Details
Message-ID:
<11bo6pv$36mvl$3@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> <11bnfpm$i84l$1@dont-email.me> <11bng23$iblc$1@dont-email.me> <11bngj1$ifj5$1@dont-email.me> <11bnnbg$l7i1$1@dont-email.me> <11bntk0$nsbo$1@dont-email.me> <11bnvbq$olbj$1@dont-email.me> <11bnvl2$opb9$1@dont-email.me> <11bnvug$otdl$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: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Mon, 26 Oct 2026 19:39:59 +0100 Organization: A noiseless patient Spider Lines: 51 Message-ID: <11bo6pv$36mvl$3@dont-email.me> References: <119qf6l$2rmg3$1@dont-email.me> <11ba02r$3pl5h$1@dont-email.me> <11bnfpm$i84l$1@dont-email.me> <11bng23$iblc$1@dont-email.me> <11bngj1$ifj5$1@dont-email.me> <11bnnbg$l7i1$1@dont-email.me> <11bntk0$nsbo$1@dont-email.me> <11bnvbq$olbj$1@dont-email.me> <11bnvl2$opb9$1@dont-email.me> <11bnvug$otdl$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 26 Oct 2026 18:40:00 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3365877"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19QgrIO8fzJDQEWwQ5jeLt7"; posting-host="19d1ea9e7f795db0e508001a96a33a1f" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:U9unZkEMw61Br4l3lValeN+dI9c= sha256:1cDADci5cOCYt3EzHdBVOU+mT7Y26R108WeB0os5s8Q= sha1:RRmYuJnWcraw7BVH1M3yQqos2mI= sha256:d0NBLBZ1/N5JSC980Xvy4AAjbV+H5MAOYhA/lbWhFpU= Content-Language: en-US In-Reply-To: <11bnvug$otdl$1@dont-email.me>