🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #823

Re: Taming The Switch-Statement

#823
From: fir
Date: Mon, 26 Oct 2026 21:37
152 lines
6855 bytes
bartc pisze:
> On 26/10/2026 20:13, fir wrote:
>> bartc pisze:
>>> On 26/10/2026 19:39, fir wrote:
>>>> bartc pisze:
>>>
>>>>>> 1 no divides (by 2 or 3)
>>>>>> 2 divides by 2
>>>>>> 3 divides by 3
>>>>>> 4 divides by 2
>>>>>> 5 no divides (by 2 or 3)
>>>>>> 6 divides by 2
>>>>>> 6 divides by 3
>>>>>> 7 no divides (by 2 or 3)
>>>>>> 8 divides by 2
>>>>>> 9 divides by 3
>>>>>> 10 divides by 2
>>>>>> 11 no divides (by 2 or 3)
>>>>>> 12 divides by 2
>>>>>> 12 divides by 3
>>>>>> 13 no divides (by 2 or 3)
>>>>>> 14 divides by 2
>>>>>> 15 divides by 3
>>>>>> 16 divides by 2
>>>>>> 17 no divides (by 2 or 3)
>>>>>> 18 divides by 2
>>>>>> 18 divides by 3
>>>>>> 19 no divides (by 2 or 3)
>>>>>
>>>>> OK, thanks. So the pattern you're talking about is this:
>>>>>
>>>>>    case (c1) {s1}
>>>>>    case (c2) {s2}
>>>>>    case (c3) {s3}
>>>>>    else      {s4}
>>>>>
>>>>> where each of s1/s2/s3 is executed if the corresponding c1/c2/c3 is 
>>>>> true, independently of the others. At least one statement will be 
>>>>> executed in 7 of the 8 possible boolean combinations in this example.
>>>>>
>>>>> s4 is only executed when each of c1/c2/c3 is false. In other words:
>>>>>
>>>>>    if (c1) {s1}
>>>>>    if (c2) {s2}
>>>>>    if (c3) {s3}
>>>>>    if (!c1 && !c2 && !c3) {s4}
>>>>>
>>>>> Assuming c1/c2/c3 are not modified by s1/s2/s3, but this is also 
>>>>> partly the case with your proposal.
>>>>>
>>>>> Or maybe it can be done like this:
>>>>>
>>>>>    if (c1 || c2 || c3) {
>>>>>        s4
>>>>>    else if (c1) {s1)
>>>>>    ....
>>>>>
>>>>> The syntax will anyway need some work to tie all those case/if 
>>>>> parts together (as s2 for example could contain nested versions).
>>>>>
>>>>> Or you can forget about having to create a hard-to-grasp and 
>>>>> awkward- to-implement feature like this, and either use workarounds 
>>>>> like my C examples, or use another approach to the problem.
>>>>>
>>>>>
>>>>>
>>>> hahaha
>>>>
>>>> lol ye use worakarounds instead of simple right solution
>>>
>>> The right solution to what problem? It took multiple posts before you 
>>> even managed to explain how your proposal is supposed to behave.
>>>
>>
>> well i was surprised how slow you think it is the reason you get 
>> things slow - and that s why it took multiple posts
> 
> Mainly from you failing to explain? You wrote comments like this:
> 
> "this wouldnt work imo as far as im aware becouse this last else dont 
> work on "group'"
> 
> IMO? It either works or it doesn't, and if not, explain why 'or' was not 
> just an alias for 'else'.
> 

i was already talked on it how many times i need to repeat it you think


if you personally take it a hundred times you think i need to reperat it 
100 times ?

else dont work becouse you dont need a group else this is else who woork on
som elogical expresion on group of ifs


"a else {}" work  on sole a (where a is "if () {}"

you need else who works on group of ifs tied with thse logicel operators

( if() {} or  if() {} and if() {}  ) else {}

this else work on group and in case of implementing some things properly 
you need such group else

instead of else you can also have some other keywords

i mean of group produce binary logical value then two will
suffice (than and else) but you evetually also not use logical operators 
and and r but use some more keywords alternatively


if if if if if all {}
if if if if if none {} //none works here as this ors and group else


whats the point of me getteing to those various conclusions - point is 
so called "science"... thiose various conclusion make some deeper view 
on language specifficely on what i call deeper C


i may say its generally surprising some people dont underrstand many 
things here such bad.. but what people understand is somewhat side 
thing, sine specialised content shallow group of people understoods

as i said i got no time to explain things you specifically dont 
understand for hours - i can explain it to you by putting one post or 
two but answering if for hours a day is too much



>> and i make laugh becouse its funny how some slowly take some things 
>> and how bad answer thay give - its kinda laughable
> 
> Well, this is the thing: given a well-specified, well-thought-out 
> feature, I can probably implement it in one of my compilers within a day.
> 
> That can serve as a proof-of-concept, and can be used to see how well it 
> stands up and how useful it actually is.
> 
> This one wouldn't pass that bar. But also, I've not convinced that you 
> put much thought into it. If I implemented it, you'd change your mind 
> about it, or add new twists, or get bored and think up something else.
> 
> It would be a waste of time.
> 
> So what's the purpose of these hundreds of wacky, random ideas: do you 
> expect someone else to implement them for you? If so, in which language?
> 
> Today was a bit of fun, but I can't take your ideas seriously.
> 
Technical Details
Message-ID: <11boh6p$104v3$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> <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> <11bo02r$otr5$1@dont-email.me> <11bo0ul$pbso$1@dont-email.me> <11bo1bc$phlr$1@dont-email.me> <11bo86r$sgm6$1@dont-email.me> <11boaad$td13$1@dont-email.me> <11bobf0$tsad$1@dont-email.me> <11boc9j$u7lh$1@dont-email.me> <11boeqe$v8bn$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: Mon, 26 Oct 2026 22:37:29 +0100
Organization: A noiseless patient Spider
Lines: 152
Message-ID: <11boh6p$104v3$1@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>
 <11bo02r$otr5$1@dont-email.me> <11bo0ul$pbso$1@dont-email.me>
 <11bo1bc$phlr$1@dont-email.me> <11bo86r$sgm6$1@dont-email.me>
 <11boaad$td13$1@dont-email.me> <11bobf0$tsad$1@dont-email.me>
 <11boc9j$u7lh$1@dont-email.me> <11boeqe$v8bn$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 21:37:29 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1053667"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+siCUiC5w67qkC2b4BwNQPuZDpoBOIjyA="; posting-host="524fd3863234ce524468884467e01d13"
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:TXWSGXd5J1YHPQ4jX6j+j3iajoU= sha256:GZp2G/n3S5xWx3Mq4aC6PD0G7bPwetEbjIY3fi2pkZw=
	sha1:6FeUVuMmXcQ4/RuRvD2hk21isVI= sha256:qUTVbsbQuOYOklh6O1/O/9x1GJ97LeZEddopdgcmb/k=
In-Reply-To: <11boeqe$v8bn$1@dont-email.me>