case expressions/transfers

Henry Cejtin henry@sourcelight.com
Wed, 9 Jan 2002 17:18:42 -0600


I  know  of  one case where it is worth while to not require a default in the
case of a case statement on a Char/Word8: a byte-code interpreter.  Sadly gcc
doesn't get this case, and people end up doing horrible things like modifying
the assembler output of gcc just to handle it.  Actually, I know that Siskind
gets pimped in Stalin because gcc also doesn't handle things like

    switch (xxx & 0x7) {
    case 0x0:
            ...
    case 0x1:
            ...
    case 0x7:
            ...
    }

These  cases  come up when he is dispatching on the type encoded in some bits
of a word.

As to the test case being  invalid,  isn't  this  clearly  legal  ML?   I.e.,
redundant cases are required to give you a warning, which I always took to be
a clear indication that they are legal.  (Or are you talking about being  not
legal for some intermediate MLton level?)