Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mprvaxa.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!hogpc!houti!ariel!vax135!cornell!uw-beaver!ubc-vision!mprvaxa!keashly From: keashly@mprvaxa.UUCP Newsgroups: net.lang.c Subject: What should a C compiler do? Message-ID: <501@mprvaxa.UUCP> Date: Fri, 23-Mar-84 17:16:12 EST Article-I.D.: mprvaxa.501 Posted: Fri Mar 23 17:16:12 1984 Date-Received: Sun, 25-Mar-84 21:03:52 EST Organization: Microtel Pacific Research, Burnaby BC Lines: 35 While playing with pcc I stumbled on the following bits of C that I think are handled incorrectly. The following code contains two examples: m(){ int a,b,c; float d; /* case 1 a float switch which the compiler should flag as an error (K&R 202) but pcc (4.1 BSD) doesn't and it spits out incorrect code. */ switch (d) { case 4: break; case 3: break; } /* case 2 ideally "a" should have the same value after but pcc interprets them differently (K&R say that it is OK 185) */ if ( a = b++ + b ); a = b++ + b; } All I'm after are comments on the two cases. Myself, I believe 1 is wrong and 2 disturbing. Thanks. -- Lance Keashly Microtel Pacific Research ..decvax!microsoft!ubc-vision!mprvaxa!keashly 8999 Nelson Way Burnaby, B.C., Canada, V5A 4B5