Patch: Add TOUPPER/TOLOWER to system.h and clean up ctype stuff
Gavin Romig-Koch
gavinATcygnus.com
Tue Sep 14 08:05:00 GMT 1999
Richard Henderson writes:
> On Mon, Sep 13, 1999 at 11:55:14AM -0400, Kaveh R. Ghazi wrote:
> > Because if the parameter is an int you can't distinguish EOF.
> > So the cast is only valid if the parameter is a char.
>
> I thought of an ugly way to do this --
>
> #define DOIT(CH) doit(sizeof(CH) == 1 ? (int)(unsigned char)(CH) : (int)(CH))
Less ugly (my opinion):
#define DOIT(CH) doit((CH) == EOF ? (int)CH : (int)(unsigned char)(CH))
along with a comment explaining what's going.
-gavin...
More information about the Gcc-patches
mailing list