Liste des Groupes | Revenir à cl c |
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.
Les messages affichés proviennent d'usenet.