| Deutsch English Français Italiano |
|
<vtlkpf$3mmqu$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Richard Heathfield <rjh@cpax.org.uk>
Newsgroups: comp.lang.c
Subject: Re: Loops (was Re: do { quit; } else { })
Date: Tue, 15 Apr 2025 13:51:59 +0100
Organization: Fix this later
Lines: 29
Message-ID: <vtlkpf$3mmqu$1@dont-email.me>
References: <vspbjh$8dvd$1@dont-email.me>
<87ikndqabc.fsf@nosuchdomain.example.com> <20250410115501.000037a5@yahoo.com>
<vt8ei8$2vn84$1@dont-email.me> <20250410080629.532@kylheku.com>
<vt94q5$3jjod$1@dont-email.me> <vt9628$3hhr8$3@dont-email.me>
<vtammh$174ev$1@dont-email.me> <vtavn9$1dp7m$3@dont-email.me>
<vtb8nv$1plb2$2@dont-email.me> <vtba81$1qfbm$1@dont-email.me>
<vtbc6o$1te2o$1@dont-email.me> <vtbhjv$24api$1@dont-email.me>
<vtbn2k$293r1$1@dont-email.me> <vtc19j$2kqlj$1@dont-email.me>
<87a58mqt2o.fsf@nosuchdomain.example.com> <vtc7mp$2q5hr$1@dont-email.me>
<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> <vtj97r$1i3v3$1@dont-email.me>
<vtl166$36p6b$1@dont-email.me> <vtlcg0$3f46a$2@dont-email.me>
<20250415153419.00004cf7@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 15 Apr 2025 14:52:00 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="518c54d255421e14a04c2a4e021ec872";
logging-data="3890014"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/AUnI4YqB8IQeLrKu+dXJYX9hs22VuV5bi+bgofoY04A=="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:jXQxLeZwt63+YOJX3rSmZ+3ky1M=
Content-Language: en-GB
In-Reply-To: <20250415153419.00004cf7@yahoo.com>
On 15/04/2025 13:34, Michael S wrote:
<snip>
> I suspect that 'while' loop is here in C because Dennis Ritchie wanted
> 'do .. while() ' and thought that if the keyword is here anyway than
> why not reuse it?
> In the hindsight, probably a mistake.
In hindsight:
$ find . -name \*.c | xargs cat | wc -l
126343
$ find . -name \*.c | xargs grep -w while | wc -l
556
$ find . -name \*.c | xargs grep -w for | wc -l
1258
So although I use for() about twice as much as I use while(), I
still find while a better option one time in three. That's useful
enough to make it worth keeping in the toolbox.
--
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within