Article View: comp.lang.c
Article #830Re: Taming The Switch-Statement
From: Chris M. Thomasson
Date: Mon, 26 Oct 2026 22:01
Date: Mon, 26 Oct 2026 22:01
48 lines
3343 bytes
3343 bytes
On 10/26/2026 2:55 PM, bartc wrote:
> On 26/10/2026 21:43, Chris M. Thomasson wrote:
>> On 10/26/2026 2:11 PM, bartc wrote:
>>> On 26/10/2026 20:32, fir wrote:
>>>> bartc pisze:
>>>
>>>>> OK, try a simple experiment: convert some code using your 'or'
>>>>> keyword to regular C syntax and post it here. Preferably on a real
>>>>> example.
>>>>>
>>>>
>>>> you cant properly convert this or/and groups to c in good way
>>>> becouse there is flaw in c you cannot express all needed
>>>> combinations generally with sole if 's and else's
>>>>
>>>> as was showed here
>>> There are a couple of reasons to express it in C:
>>>
>>> * To illustrate exactly how you want the semantics to work, via
>>> an existing language whose behaviour is well known
>>>
>>> * To highlight the problem areas
>>>
>>> For example:
>>>
>>> if (f1()) {}
>>> if (f2()) {}
>>> ...
>>
>>
>>
>>
>>> if (!f1() && !f2()) {}
>>>
>>> Here f1/f2 are called twice. This means making internal copies or
>>> setting flags.
>> Also, if f1 succeeds, then f2 might not have to be called at all
>> because it already broke the contract?
> No, the 'if f2(){}' line must be executed whether f1() was true or also.
>
> As I understand the feature: they are independent conditional blocks.
> But the final else{} must be executed if all were false.
>
> I think if you have to explain it, then it's a bad sign!
Oh shit. I was isolating the following line, not the two previous calls:
if (!f1() && !f2()) {}
Technical Details
Message-ID:
<11boijg$10l23$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> <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> <11bodc6$ul1k$1@dont-email.me> <11bofl7$vjil$1@dont-email.me> <11bohh7$107r1$1@dont-email.me> <11boi82$10j3c$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: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Mon, 26 Oct 2026 15:01:20 -0700 Organization: A noiseless patient Spider Lines: 48 Message-ID: <11boijg$10l23$2@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> <11bodc6$ul1k$1@dont-email.me> <11bofl7$vjil$1@dont-email.me> <11bohh7$107r1$1@dont-email.me> <11boi82$10j3c$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 22:01:21 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1070147"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+n4+ihFMD+HaZJobQLMJfWkTHkw49TBvA="; posting-host="49da529de1e605d0c2cf1bd5b7b86f4a" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:5hj7TTxt9+yR/ulr1FVWE3SDgTI= sha256:bNMAocrfR5n7ghyBV2SJud0pM9ko0HfdVRrdXXcCT0k= sha1:+S8Xoig+ihQO0yHe4Qz/C0sE7RY= sha256:SRtFpkeA9qvt/WPwSBIsqCfIeRxV23lFD8AMrtnLEYE= In-Reply-To: <11boi82$10j3c$1@dont-email.me> Content-Language: en-US