Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!think!ima!haddock!karl From: karl@haddock Newsgroups: net.lang.c Subject: Re: Significant deficiency in C Message-ID: <86900071@haddock> Date: Thu, 2-Oct-86 10:33:00 EDT Article-I.D.: haddock.86900071 Posted: Thu Oct 2 10:33:00 1986 Date-Received: Sat, 4-Oct-86 06:40:37 EDT References: <4200@brl-smoke.ARPA> Lines: 19 Nf-ID: #R:brl-smoke.ARPA:4200:haddock:86900071:000:909 Nf-From: haddock!karl Oct 2 10:33:00 1986 00R0DHESI%bsu.cs@CSNET-RELAY.ARPA (Rahul Dhesi) writes: >I think [char to int promotion] is a significant deficiency in C. Is ANSI >doing anything to eliminate this or decrease its effect? I doubt it. Too many programs depend on it. >Considering that [most] UNIX tools do text processing in 7-bit units, ... But if they use getchar(), they have to declare the variable "int" anyway. However, a compiler is free to use 8-bit arithmetic if it can determine that the result will be the same (e.g. char2 = char0 + char1); I think more work needs to be done in this area. (Of course, there will always be cases where it lacks the information to perform the optimization.) Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint P.S. I just tried c2=c0+c1 on the vax; it did cvtbl, cvtbl, addl2, cvtbl, and cvtlb. This sort of slop encourages programmers to declare everything "int".