Sujet : Re: Loops (was Re: do { quit; } else { })
De : tr.17687 (at) *nospam* z991.linuxsc.com (Tim Rentsch)
Groupes : comp.lang.cDate : 14. May 2025, 19:09:51
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <86sel7ukr4.fsf@linuxsc.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.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Michael S <
already5chosen@yahoo.com> writes:
(I am summarizing heavily in an effort to return to the main area
of interest.)
On Sun, 11 May 2025 17:30:14 -0700
Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
>
Michael S <already5chosen@yahoo.com> writes:
[...]
[suggestion to keep for() and eliminate while()]
>
[a mention was made of statistics given in another posting
that reported a ratio of while()/for() of roughly 2.3 to 1.]
>
[upthread there was a different posting, from Richard
Heathfield, that gave statistics reflecting a ratio
of for()/while() of approximately 3 to 1, IIRC]
I did a more comprehensive gathering of statistics, using an ad hoc
collection of 68 open source projects, ranging in size from just
over 1500 lines to over a million lines, including two outliers
with 20 million lines and 75 million lines. The ratio of while()
to do/while() ranged from 12.5% to 2100%, with an average of
573.9%. The ratio of while() to for() ranged from 1.6% to 300%,
with an average of 60.8%.
[...] while() does not help anything relatively to for().
I understand that that is your view. I don't remember seeing any
supporting statements other than your personal reactions. My own
experience is different. Judging by the open source statistics
reported above, it appears that a fair number of other developers
don't share your views on this question either.