Switch and break
Manfred Nowak
svv1999 at hotmail.com
Thu Jan 19 15:37:13 PST 2012
RenatoL wrote:
> why in D we are not obligated
This depends on how the designer wants the coders to think about the
semantics of a <label>.
If a <label> _always_ is an _additional_ entry into an otherwise linear
sequence of commands, then fall-through as standard is the consequence.
If a <label> _always_ breaks the linear sequence of commands, then an
implicit `break' as standard is the consequence.
Because <label>s outside of `switche's are always additional entries
only, one has to specify `case's as not to be <label>s or to have a
good reason for the different handling of `label's.
So it is up to you to show that `case's are not`label's or give a good
reason, if you want a different handling.
-manfred
More information about the Digitalmars-d-learn
mailing list