Matching Data Types

Mark Harrison harrison at necssd.NEC.COM
Sat May 5 01:58:14 AEST 1990


In article <1639 at tkou02.enet.dec.com>,
       diamond at tkou02.enet.dec.com (diamond at tkovoa) writes:
 
> False.  In an implementation where sizeof(int)==1 (perfectly legal, as
> long as it's at least 16 bits), EOF might also be a valid char value.

But doesn't this conflict with K&R/1 p.42?

"The real reason for using int instead of char is not related to any
questions of possible sign extension.  It is simply that getchar
must return all possible characters (so that it can be used to read
arbitrary input) and, in addition, a distinct EOF value.  Thus its
value *cannot* be represented as a char, but must instead be stored
as an int."  [emphasis on *cannot* theirs]
-- 
Mark Harrison             harrison at necssd.NEC.COM
(214)518-5050             {necntc, cs.utexas.edu}!necssd!harrison
standard disclaimers apply...



More information about the Comp.lang.c mailing list