Lang. suggestion: auto-fallthrough and comparison shorthands
Rioshin an'Harthen
rharth75 at hotmail.com
Sat Jul 1 05:33:45 PDT 2006
"Frank Benoit" <keinfarbton at nospam.xyz> wrote:
> The idea with 'continue' and implicit 'break' for a fallthrough is
> great. I second that.
And I most definitely third the suggestion. :)
> I have had much more errors with accidentally fallthroughs than I used
> it productive. And if I use fallthrough such rarely, its good to write
> it explicit that it should really fallthrough in this case.
On too many occasions, working in C, C++ or D, I've had accidental
fall-throughs. (Too much coding FSM's with switch statements tend to cause
that.)
If it breaks existing code, so what? Or about making it that tiny bit harder
to translate C or C++ code? We're still at pre-1.0 - any code breaking is to
be expected (re the discussion on implicit const).
It seems much more sensible that the break be implicit, instead of the
continue. The break, at least in code I've written, is on about 90% on the
cases, with the rest being fall-through. But if we can't get this, then at
least *warn* of a missing continue or break at the end of a case; that way,
the code will be much safer when we see we're missing one or the other, and
explicitly put it in.
More information about the Digitalmars-d
mailing list