Sujet : Re: Loops (was Re: do { quit; } else { })
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 17. Apr 2025, 01:26:46
Autres entêtes
Organisation : None to speak of
Message-ID : <87r01rzl89.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.13 (Gnus v5.13)
bart <
bc@freeuk.com> writes:
On 16/04/2025 21:03, Keith Thompson wrote:
bart <bc@freeuk.com> writes:
On 16/04/2025 06:35, Janis Papanagnou wrote:
On 15.04.2025 22:46, bart wrote:
On 15/04/2025 20:07, Scott Lurndal wrote:
[...]
Real for loops _are_ a three-way construct.
>
[...]
>
Any step other than 1 is unusual. [...]
>
Nonsense. Arithmetic loop steps other than one are noting unusual
and been supported by programming languages (and also been used)
since decades in programming.
>
So what are you claiming, that the majority of loops in any given
program will have steps other than +1 or -1?
Exactly, because "unusual" and "the majority" are the only
possibilities.
>
I'm not sure what you're getting at.
I think the misunderstanding is over the meaning of the rather
vague word "unusual".
Did you really think that Janis was claiming that "the majority of
loops in any given program will have steps other than +1 or -1"?
If not (and I don't believe you did), why did you ask that question?
Were you being sarcastic? (If so, I can see how my responding
to your sarcastic remark with one of my own might have been
inappropriate.)
I recognize that sarcasm isn't always obvious in writing. I find it
particularly difficult to recognize sarcasm from someone with whom
I have strong disagreements; it can be difficult to distinguish
between seemingly absurd statements that are sarcastic and ones
that are actual statements of belief or opinion.
I assumed that you would recognize that my statement about "unusual"
and "the majority" would be recognized as sarcasm. Was it not?
I speculate that the disagreement was over the meaning of "unusual"
(something that I suggest is not useful to debate here). Certainly
increment values other than +1 and -1 are less common (and -1 is
less common than +1), and saying that such values are "unusual"
is not unreasonable, but to some the word "unusual" might carry
more negative implications.
[...]
So what is your point?
You clearly would prefer a for loop that iterates over a range of
discrete values rather than C's far more general for statement.
I'm not sure I'd even object to adding such a statement to C in
a future standard, though I don't think it's likely to happen.
But if it did, would you want support for incrementing by +1,
incrementing by either +1 or -1 (Pascal uses "downto" and Ada uses
"reverse" for this), or for incrementing by any arbitrary value
(Modula-2 uses "by" for this with "by -1" to iterate in reverse)?
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */