Re: [C--] qc-- fails to compile switch statement
Norman Ramsey <[email protected]> Fri, 20 Mar 2009 15:13:57 -0400
| Newsgroups | gmane.comp.lang.c-- |
|---|---|
| Message-ID | <[email protected]> |
> Hi,
>
> It seems qc-- cannot compile test-047.c-- in the test2 folder.
If you look in the output directory, it's not supposed to
compile---it's supposed to produce error messages.
> I have a switch statement which is compiled as the follow:
>
> switch bits8[_mlcc_ea__tmp_ce_7]
> {
> case 119::bits8: {
> goto main0000019;
> }
> case 87::bits8: {
> goto main0000020;
> }
> case 116::bits8: {
> goto main0000023;
> }
> case 84::bits8: {
> goto main0000024;
> }
> case 100::bits8: {
> goto main0000027;
> }
> case : {
> goto main0000030;
> }
> }
>
>
> The last case represents a default case in the original C code. But qc--
> reports "Error: case arm has an empty range list"
>
> Did I do something wrong? What's the correct way to represent C default
> case in C--?
There is no default case, so you did do something wrong---you need
either to assert a limited set of ranges on the switch, or give all
the missing values in the case. Example
case 0..83, 85, 85, 88..99, 101..115, 117, 118, 120..255:
I never should have let the Nameless One talk me into a switch statement :-)
Norman
_______________________________________________
Cminusminus mailing list
[email protected]
https://www.eecs.harvard.edu/mailman/listinfo/cminusminus