egcs, casting the argument of eg isalpha to an int...

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Fri Feb 13 17:41:00 GMT 1998


	I'm getting a lot of warnings building egcs of the form
"subscript has type `char'".  These seem to occur because the ctype
is* functions (eg isalpha) are used and passed a `char' type.  These
functions are prototyped in ctype.h as taking an int parameter but
they are often defined as macros which do a lookup in an array like
this:

 > #define isalpha(__c) (__ctype2[__c]&(_A))

So this appears to be the source of the warning.


	Now system.h has custom versions of the ctype macros which
look like this:

 > #define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))

I'm thinking of changing them to this:

 > #define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (((int)(c))))

This would seem to avoid the warning.

	Is this solution correct from a technical standpoint?

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		ICon CMT Corp.



More information about the Gcc mailing list