Liste des Groupes | Revenir à cl c |
bart <bc@freeuk.com> writes:
Are you bothered by the fact that "break" applies to all threeNo. But 'switch' isn't iteration. (In my language, there /is/ a looping switch statement. That uses the same loop controls as regular loops. Those are not allowed in normal switch.)
kinds of iteration statements (while, do, for)?
Sure, the fact that "break" is overloaded can be slightlyMy experience of multi-level break is that there are two main use-cases:
inconvenient. So can the fact that "break" only exits the
*innermost* enclosing loop or switch.
Using two different keywords (which, to be clear, is unlikely to
happen in any language called "C") would only solve a small part of
the problem. What I'd really like to see is a mechanism for "break"
(or "continue") to apply to a *named* enclosing construct, something
I've found very useful in other languages that support it. It would
provide an easy solution to the scenario you mentioned above.
Les messages affichés proviennent d'usenet.