--- Comment #2 from 2011-06-30 03:34:31 PDT ---
(In reply to comment #1)
> V551 happens because in C a 'char' can be signed and people forget that. I
> doubt if the same argument could apply to D.

Mistakes happen in D too, you use a variable with a range smaller than the
cases you have used in the switch. I'd like the compiler to tell me when a case
is impossible, because it's probably a bug, and this warning/error doesn't
damage generic code a lot because in generic code you are always able to add
cases using a "static if":

switch (foo) {
  case 0: break;
  static if (typeof(foo).max >= 200)
    case 200: break;

Regarding your specific comment, in my second example I have used a byte. In
another bug report (that's now a WONTFIX) I have argued that for the mind of
most programmers (me too) a byte is an unsigned value (this is also why in C#
you don't have just byte and ubyte, there is sbyte). If by mistake you think of
a D byte value as an unsigned value it's easy to add a case 200, that can't

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to