Signedness of chars

Doug Gwyn gwyn at brl-smoke.ARPA
Fri Mar 4 23:05:40 AEST 1988


In article <23209 at ucbvax.BERKELEY.EDU> hilfingr at tully.Berkeley.EDU.berkeley.edu (Paul Hilfinger) writes:
>Does anyone know of widely-used programs that depend on the type
>`char' being signed?  That is, how many programs would break if
>`unsigned char' and `char' were the same type?

A large number of PDP-11 UNIX programs were in this category, for example
much of the GPS-based PWB/Graphics.  By now, I think the version in use here
has all these bugs fixed.  (NOT the AT&T way, which was to use #ifdef u3b2
rather than change the code to work portably.)

The most common portability error in this regard is
	char c;
	while ((c = getchar()) != EOF)
		...



More information about the Comp.lang.c mailing list