[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problems/risks due to programming language, stories requested
In article <6960@internal.Apple.COM>, chewy@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@ee.rochester.edu
"The faster I go, the behinder I get." --Lewis Carroll