Sujet : Re: Whaddaya think?
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 19. Jun 2024, 01:55:36
Autres entêtes
Organisation : None to speak of
Message-ID : <87tthpycmv.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Tim Rentsch <
tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
Kaz Kylheku <643-408-1753@kylheku.com> writes:
>
Speaking of while, the do/while construct does not require parentheses
in order to disambiguate anything, since it has a mandatory semicolon.
Yet, it still has them.
>
It has them to allow an extension for a "loop-and-a-half" control
structure:
>
do statement while ( expression ) statement
>
and so for example
>
do c = getchar(); while( c != EOF ) n++;
>
to count characters on standard input.
>
Oh? Do you have any evidence that that was the intent? [...]
>
I think you're reading something into my remark that it
didn't say.
Or at least that you didn't mean.
What did you actually meant by "It has them to allow an extension
..."? It seemed very clear to me that you meant to imply an intent,
and I can't think of any other sensible interpretation of your words.
do-while *could* have been specified without required parentheses.
The only reason I can think of that it wasn't is consistency
with other constructs (if, for, while), and in my opinion that's
a perfectly valid reason. If you're seriously suggesting that
there's another reason, I'd be interested in learning about it.
If any existing compiler has the loop-and-a-half extension you
mentioned, or anyone even considered such an extension, I'd be
interested in learning about that as well. (If it was a joke,
just say so and we can drop this.)
Of course you could have explained what you meant in the first place.
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */