Deutsch   English   Français   Italiano  
<vgaemm$ui29$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.lang.c
Subject: Re: else ladders practice
Date: Mon, 4 Nov 2024 13:29:09 +0100
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <vgaemm$ui29$1@dont-email.me>
References: <3deb64c5b0ee344acd9fbaea1002baf7302c1e8f@i2pn2.org>
 <vg0t3j$2ruor$1@dont-email.me>
 <78eabb4054783e30968ae5ffafd6b4ff2e5a5f17@i2pn2.org>
 <864j4pv76h.fsf@linuxsc.com> <6726C97C.4080807@grunge.pl>
 <86ldxztzpk.fsf@linuxsc.com> <vgacoi$tr9q$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 04 Nov 2024 13:29:10 +0100 (CET)
Injection-Info: dont-email.me; posting-host="8d079aa75fd38748b8331ca709202c73";
	logging-data="1001545"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/RapEsegakxS/5/1McFswt"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
Cancel-Lock: sha1:oGmLZpT4mMboBIxTV8D9cCqgmBk=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <vgacoi$tr9q$1@dont-email.me>
Bytes: 2524

On 04.11.2024 12:56, Bart wrote:
> [...]
> 
> Here, the question was, can:
> 
>         if (c1) s1;
>    else if (c2) s2;
> 
> always be rewritten as:
> 
>    if (c1) s1;
>    if (c2) s2;

Erm, no. The question was even more specific. It had (per example)
not only all ci disjunct but also defined as a linear sequence of
natural numbers! - In other languages [than "C"] this may be more
important since [historically] there were specific constructs for
that case; see e.g. 'switch' definitions in Simula, or the 'case'
statement of Algol 68, both mapping elements onto an array[1..N];
labels in the first case, and expressions in the latter case. So
in "C" we could at least consider using something similar, like,
say, arrays of function pointers indexed by those 'n'. (Not that
I'd suggest that by just pointing it out.)

I'm a bit astonished, BTW, about this huge emphasis on the topic
"opinions" in later posts of this thread. The OP asked (even in
the subject) about "practice" which actually invites if not asks
for providing opinions (besides practical experiences).

(He also asked about two specific aspects; performance and terse
code. Answers to that can already be derived from various posts'
answers.)

Janis

> [...]