problems/risks due to programming language, stories requested
David F. Carlson
dave at micropen
Sat Mar 3 06:19:01 AEST 1990
In article <6960 at internal.Apple.COM>, chewy at apple.com (Paul Snively) writes:
>
>
> For what it's worth, my personal opinion is that C lends itself to
> precisely the kinds of errors noted above--when does break work and when
> doesn't it, and why in God's name do you need it in switch statements in
> the first place, etc.
What break does is *very* well defined and is no more prone to misinterpretation
that any other non-linear control flow statement in any other PL.
>From K&R2 p 244:
A9.5: iteration statement is (for, while, do)...
A break statement may appear only in an iteration statement or a switch
statement; control passes to the statement following the terminated
statement.
A multi-case switch is very handy in many situations to reduce identical
treatments for similar cases. That you ask the question of the usefulness
of break-per-case/multiple-cases implies that you haven't sufficient experience
with the construct to judge its merits/weaknesses.
Dijkstra notes that no programming language can prevent a poor programmer from
creating bad programs.
--
David F. Carlson, Micropen, Inc.
micropen!dave at ee.rochester.edu
"The faster I go, the behinder I get." --Lewis Carroll
More information about the Comp.lang.c
mailing list