Nikola said:
I think that the fallthrough concept is clearer than jumping to the
next line with "goto".
It's more concise, but definitely not clearer. In C (or C++) the only
indication that execution continues with the next block is the *absence* of
a branch construct (such as break or return) and since 99+% of cases do end
with a branch, my brain tends to add the missing "branch" while you're
reading the code.
Whereas with explicit goto the sequence of execution is abundantly clear. I
suppose there could have been a "fallthrough" keyword equivalent to "goto
case <whatever-comes-next>" or even a designator on the switch block as a
whole to permit silent fallthrough. But I definitely prefer the C# decision
to require the programmer to explicitly request fallthrough -- it's used so
infrequently that a case block without a branch construct is a bug more
often than not.
Besides, the whole purpose of Duff's device is to make the first
iteration start at any one of the lines depending on a single
variable. If you wanted to do that with goto instead of switch, you'd
need a really ugly if ... else if ... else if ... block, or another
switch which is quite pointless because you can just use the Duff's
device then.
Duff's device also allows starting in the middle of the loop on the first
iteration, which is more efficient execution-wise than mid-loop exit
conditions. But so would a plain goto from outside the loop, or a compiler
smart enough to reorder the halves of the loop to eliminate the
unconditional branch at the bottom.
The only reason I mentioned Duff's device here though, is because its
elegance (as an optimized solution) is obliterated by the use of
gotos on each line.
Duff's device isn't possible in C# at all AFAIK, you can't have looping
constructs stretching across multiple cases.