[Issue 14411] switch statement: docs/behavior differ
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Apr 5 12:25:23 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14411
--- Comment #4 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
(In reply to Cody Casterline from comment #3)
> > specs says nothing about other cases.
>
> Well, it says that ScopeStatementList "must" be empty, or be ended [...].
> Which I read to mean there are no other cases. "This is to set apart with
> C's error-prone implicit fall-through behavior." so I would not expect
> fall-through to work like in C.
somehow that means "programmer must adhere to specs", but not "compiler must
not accept that code". i don't know why.
> > "case 1, 2:" is not what you may think, it equals to "case 2:".
>
> Oh? Then why did fn(1) run "A"?
hm. 'cause i misread the specs. sorry. i'm too used to the "in comma
expressions only the last result matters" rule.
--
More information about the Digitalmars-d-bugs
mailing list