ajg@csvx002.UUCP (05/27/87)
I am currently trying to port version 1.2 of C++ to an Encore Multimax running UMAX 4.2. The Encore's C compiler will not accept switch statments whose case labels are not all in the same block (as in example below). (According the Umax manual, this is an anomaly found only in Portable C). The cfront program outputs code like this in some occurrences of switch statements in the c++ source (this occurs repeatedly in the compiler source). Does anyone know of a fix which either fixes the compiler source so this does not occur or post processor which takes these unbalanced blocks out? Any information would be appreciated. -------------- example ---------------- /* this is short example of the problem */ main() { int i ; for (i=1; i<4; i++) switch(i) { case 1 : { int i = 1 ; printf("%d", i); break ; /* } should be here */ case 2 : printf("2"); break ; case 3 : printf("3"); break ; } /* this should be above */ } ; } ------------- end of example ---------- Thanks, Alan J. Gebele {ihnp4,decvax,allegra}!brunix!ajg ajg%cs.brown.edu@relay.cs.net-relay.ARPA ajg@cs.brown.edu.CSNET
chris@mimsy.UUCP (05/28/87)
In article <15830@brunix.UUCP> ajg@csvx002 (Alan J. Gebele) writes: >The Encore's C compiler will not accept switch statments whose case labels >are not all in the same block (as in example below). >(According the Umax manual, this is an anomaly found only in Portable C). The Umax manual is wrong. See K&R, pp. 202-203. No restriction is made on case labels; case labels are *labels*. K&R is not explicit; neither, it seems, is the present dpANS. Encore has a case, but I think they are at default. :-/ -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: seismo!mimsy!chris