Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!rutgers!sri-spam!nike!ucbcad!ucbvax!jade!eris!mwm From: mwm@eris.berkeley.edu (Mike Meyer) Newsgroups: net.lang.c Subject: Re: Significant deficiency in C Message-ID: <1372@jade.BERKELEY.EDU> Date: Thu, 2-Oct-86 07:54:08 EDT Article-I.D.: jade.1372 Posted: Thu Oct 2 07:54:08 1986 Date-Received: Sat, 4-Oct-86 11:00:06 EDT References: <4200@brl-smoke.ARPA> <6129@alice.uUCp> Sender: usenet@jade.BERKELEY.EDU Reply-To: mwm@eris.UUCP (Mike Meyer) Organization: Missionaria Phonibalonica Lines: 21 In article <6129@alice.uUCp> ark@alice.UucP (Andrew Koenig) writes: >One would think that for many char operations it is possible for >the compiler to figure out that doing it in 8 bits and expanding to >16 at the end only if necessary will give the same result as expanding >to 16 bits immediately. > >Can you give us some examples of code that you think would be >impossible to get right without changing the rules? Yes. How about (from a bug report on Lattice C in net.micro.amiga): char x = 0XFF, y = 2, z ; z = (x + y) / 2 ; If you do this in character arithmetic, you get 0 (1/2). If you do it as something longer, you get 128. Of course, whether or not is is "right" is open to question.