| Deutsch English Français Italiano |
|
<670vvjht4glvq04f9dv7c4nqlffbh6a292@4ax.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Rosario19 <Ros@invalid.invalid>
Newsgroups: comp.lang.c
Subject: Re: Loops (was Re: do { quit; } else { })
Date: Wed, 16 Apr 2025 12:09:10 +0200
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <670vvjht4glvq04f9dv7c4nqlffbh6a292@4ax.com>
References: <vtcqf6$3j95s$1@dont-email.me> <vtdh4q$b3kt$1@dont-email.me> <vtf7fe$1qtpg$1@dont-email.me> <vtgfuf$31ug1$1@dont-email.me> <20250413072027.219@kylheku.com> <vtgpce$39229$1@dont-email.me> <vti2ki$g23v$1@dont-email.me> <vtin99$vu24$1@dont-email.me> <vtiuf0$18au8$1@dont-email.me> <ilprvj5jbpcbr7fts2kdotfb81763u652g@4ax.com> <vtlbja$3f46a$1@dont-email.me> <20250415152550.00007634@yahoo.com> <vtll0g$3n29t$1@dont-email.me> <20250415062839.904@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Injection-Date: Wed, 16 Apr 2025 12:09:11 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="431cd07a010af455f22b1e37a7d2e176";
logging-data="2067494"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+YZCrisev2qza9+l5gEOZ7CgygDrQ10cc="
Cancel-Lock: sha1:A8X166I2vVBjrEG7hpol7sSDhT0=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
On Tue, 15 Apr 2025 13:33:21 -0000 (UTC), Kaz Kylheku wrote:
>On 2025-04-15, bart wrote:
>> * Not having to write the variable 3 times (with C not always being
>> able to detect if they didn't match)
>
>This is indeed a source of errors in C nested loops. Say we have
>these macros:
>
> FOR (i, 0, N-1)
> FOR (j, 0, i)
> ...
>
>we are less likely to make some copy paste error like
>=20
> for (i =3D 0; i < N; i++)
> for (j =3D 0; j < i; i++)
> ...
>
>Int he past, I've run into bugs in nested loops, along these lines.
if F is a macro as #define F for
until now i not find any inconvenient for me at last
>In loop-heavy code, making a macro like the FOR above might not
>be a bad idea.