Re: on goto
Keith Thompson <kst-u@mib.org> wrote:
Nick Keighley <nick_keighley_nospam@hotmail.com> writes:
[...]
I think he proposed
for (loop_incomplete OR not_found)
for (loop_incomplete OR not_found)
for (loop_incomplete OR not_found)
if ... found <- T
that is an extra boolean (and some extra testing)
[...]
(In the above, "he" refers to Richard Heathfield; the above is obviously
a pseudocode summary of what Richard posted.)
One problem I have with the above is that the "OR not_found"
condition has to be written 3 times. I'm not very concerned
about the CPU time spent testing the variable.
I'm more concerned
about the conceptual complexity of having to write the same thing
multiple times, with the attendant risk that a typo in one of the
three occurrences (forgetting the "!" operator, for example) won't
be caught by the compiler.
And one problem I have with it is that "for" has to be written 3 times.
I'm concerned about the conceptual complexity of having to write the
same thing multiple times, with the attendant risk that a typo in one of
the three occurrences (incrementing the wrong counter in the wrong loop,
for example) won't be caught by the compiler.
It seems our concerns are very much the same, but mine is a problem with
*both* examples. :-)