[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problems/risks due to programming language
In article <1004@micropen> dave@micropen (David F. Carlson) writes:
>What break does is *very* well defined and is no more prone to
>misinterpretation that any other non-linear control flow statement ...
Yes, it's well defined, but what it's defined to do is bad.
For a formal treatment of the above statement, I refer you to my article
<firstname.lastname@example.org>, posted to comp.lang.misc (also .c and .ada) with
this same title. I haven't seen any rebuttals yet.
>A multi-case switch is very handy in many situations ...
Yeah. I wish C had this feature, instead of simulating it with fallthrough.
>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
I don't know about the person you were addressing, but I think I've had
sufficient experience with it. I certainly question its usefulness in
comparison to something reasonable, like the language I described in my other
In fact, even if you insist that the comparison must be between C and
plain-C-without-break-switch, I think I'd still go for the latter. I believe
the benefit of not requiring an overloaded keyword to do a break-switch
exceeds the cost of having to use a goto to merge related cases.
Karl W. Z. Heuer (email@example.com or harvard!ima!karl), The Walking Lint