| Deutsch English Français Italiano |
|
<87sem1yoqm.fsf@nosuchdomain.example.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: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: Loops (was Re: do { quit; } else { })
Date: Mon, 21 Apr 2025 18:22:09 -0700
Organization: None to speak of
Lines: 64
Message-ID: <87sem1yoqm.fsf@nosuchdomain.example.com>
References: <vspbjh$8dvd$1@dont-email.me> <vtl166$36p6b$1@dont-email.me>
<vtlcg0$3f46a$2@dont-email.me> <vtnekn$1fogv$1@dont-email.me>
<vto2mb$20c4n$1@dont-email.me> <vtu4i5$3hteg$1@dont-email.me>
<vtujko$3uida$1@dont-email.me> <vtvfop$rf2p$1@dont-email.me>
<vtvto2$15otp$1@dont-email.me> <vu01k7$1bfv2$1@dont-email.me>
<vu0720$1dva7$1@dont-email.me> <vu2hmg$3jn88$1@dont-email.me>
<vu2mkc$3noft$1@dont-email.me> <vu5ig6$3catv$1@paganini.bofh.team>
<vu5ol1$2h3r8$1@dont-email.me> <vu6bvn$3dsrl$1@paganini.bofh.team>
<vu6iau$377r9$1@dont-email.me>
<874iyh153g.fsf@nosuchdomain.example.com>
<vu6nnv$3apt8$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Tue, 22 Apr 2025 03:22:09 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="e72db596057d83171632e4a496618536";
logging-data="3552146"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/zE16iS4SB2ekpkvXpLEv4"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:Bp2EdDpRjLHSV7b6WX2sGxiDei0=
sha1:RWkV+PXMlZCCcA+ks5ORypUMX04=
bart <bc@freeuk.com> writes:
> On 22/04/2025 00:12, Keith Thompson wrote:
>> bart <bc@freeuk.com> writes:
>>> On 21/04/2025 22:06, Waldek Hebisch wrote:
>>>> bart <bc@freeuk.com> wrote:
>>>
>>> t iteration goes over all elements in the hash table.
>>>> BTW2: When looking at 'for' loop you are supposed to see pattern,
>>>> without need to track all steps.
>>>
>>> That's one of the disadvantages of using the same, often
>>> /inappropriate/ keyword for every kind of pattern.
>> You think it's inappropriate.
>> Would your objections go away if a different keyword were used?
>
> I already said that I would have prefered if 'while' was used.
>
> Then either 'for' wasn't used, or was used for the kind of for-loop
> that is common in other languages.
So you wouldn't mind if C had both `while (expr)` and
`while (expr1; expr2; expr3)`, with the latter having the semantics
of C's current for loop?
But that doesn't answer my question. You'd prefer "while", but would
using "while" rather than "for" resolve your objections?
>> *You* find it much cleaner and simpler. I don't. What makes you right
>> and everyone else wrong?
>
> This is an interesting point: too much stuff on one line is usually
> frowned upon: multiple statements, multiple variables being declared
> etc.
>
> But when it's a for-loop, then apparently anything goes.
For some, sure. For others, no.
>> All three would be IMHO clearer if each of the three clauses were on a
>> separate line. The fact that you can write a badly formatted C-style
>> for loop is not an argument against C-style for loops.
>
> Complex loops are nearly always badly formatted and written on one
> line. Nobody cares. As you've demonstrated.
I have demonstrated no such thing. I am not as bothered by long
for loops with odd line breaks (or none) as you think I should be,
but I have clearly expressed my personal preference for putting
each of the three clauses on its own line if they're too long to
reasonably fit on one line.
One more thing. You often snip context when posting a followup.
That's fine if you're not responding to everything, but I would
greatly appreciate it if you would mark your deletions.
For example, in my post to which you replied, I discussed at
some length how I like to split for loops if they're too long.
You snipped that discussion *and then* insinuated that I don't care
about complex loops written on one line. Please stop doing things
like that.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */