Subject: Re: Type coersion long->int ?
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Todd Whitesel <>
List: current-users
Date: 02/03/2000 23:29:02
> I don't know what's done by implementations where int and char are the
> same size.  seebs? :)

Just define a character set that doesn't fill more than half the possible
values of the char type, and you've always got a way out.

In the 8-bit int case, limiting yourself to straight ASCII (0-127) works
well: let negative char/int values be non-characters, and EOF be -1.

Supporting international characters plus EOF is trickier however, and
starts to really use some of the more recent weasel language in ISO C.
(ANSI K&R pretty much states that 'char' should be able to store a
non-negative value for every member of the machine's character set,
but Harbison & Steele 4th ed. gives the compiler a few more options.)

You really want sizeof(int) >= sizeof(char) > 8 if you care about
international characters.

Todd Whitesel
toddpw @