Re: [C--] qc-- fails to compile switch statement
Norman Ramsey <[email protected]> Sat, 21 Mar 2009 17:15:20 -0400
| Newsgroups | gmane.comp.lang.c-- |
|---|---|
| Message-ID | <[email protected]> |
> Don't mean to be offensive, but if the range is known, why should not
> the Nameless one be allowed?
C-- is a compiler-target language. Compilers should know in which
cases which arms are to be executed. The excuse for letting switch
statements into the tent was that their efficient translation might
depend on some hypothetical properties of the target machine. The
goal was not to provide a convenience to the programmer.
We require all case arms to be fully disambiguated because that helps
suss out bugs in the compiler front end.
> Given the following code snippet which is
> in test-047.c--:
>
> switch [1 .. 3] i {
> case : { return (i); }
> case 2 .. 3: { return (i); }
> }
This code snippet is designed to trigger errors in the front end.
It is not an example to be emulated.
Norman
_______________________________________________
Cminusminus mailing list
[email protected]
https://www.eecs.harvard.edu/mailman/listinfo/cminusminus