Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: characters Message-ID: <18181@haddock.ima.isc.com> Date: 24 Sep 90 23:59:13 GMT References: <13680@hydra.gatech.EDU> <2517@idunno.Princeton.EDU> <1990Sep18.162407.15525@zoo.toronto.edu> <2657@idunno.Princeton.EDU> <459@taumet.com> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 11 In article <459@taumet.com> steve@taumet.com (Stephen Clamage) writes: >The best option is not to write code which depends on the signed-ness of >chars. The primary error is writing code which uses chars as tiny >integers [which can be fixed by using ints or something] It turns out to be harder than one might suppose, even for programs that don't have that problem. Consider the case typified by `if (getchar() == *s++)': a successful getchar() always returns a zero-extended value, but `*s++' may do sign extension if `s' was declared `char *'. Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint