Re: yucky patch

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Fri, 12 Feb 1999 09:12:37 +0100

Duane Wessels wrote:

> My reason for using an int cast is:

> int isalnum(int c)
> int isalpha(int c)
> int isascii(int c)
> int iscntrl(int c)

Yes, that is the correct prototypes, but it does not say that you can
safely typecast char into int and send the resulting value to these
functions. You need to read the description as well as the prototype.

The reason why int is used and not unsigned char is that EOF is a valid
input and EOF is not an unsigned char (it is no character at all, not
even a control character). EOF is usually defined as -1.

/Henrik
Received on Tue Jul 29 2003 - 13:15:57 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:04 MST