Re: yucky patch

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Thu, 11 Feb 1999 03:58:45 +0100

Duane Wessels wrote:
>
> Should I apply this yucky thing?
>
> It eliminates the following warnings from some compilers:
>
> gcc -g -O2 -Wall -I. -I../include -I../include -c cf_gen.c
> cf_gen.c: In function `main':
> cf_gen.c:180: warning: subscript has type `char'
> cf_gen.c:185: warning: subscript has type `char'
> cf_gen.c:190: warning: subscript has type `char'

Better to fix the code to use the right types. Standard isXXXX functions
is not defined for char arguments, and the xis... functions proposed
does it wronly if char is to be supported.

Defined ranges:
char : -128 <=> +127 (on most systems, unsigned on some)
isXXXX: EOF or 0 <=> 255 (unsigned char)

Recommended action is to use unsigned char instead of char.

If the compiler still complains then send the compiler vendor to do
something about it.

Quote from Linux manpage on isXXXX functions:
       These functions check whether c, which must have the value
       of an unsigned char or EOF, falls into a certain character
       class according to the current locale.

/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