This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: signed vs unsigned pointer warning


Jamie Lokier <jamie@shareable.org> writes:
>Dave Korn wrote:
>>   As I said, I think the standard makes it quite clear that you can pass -1
>> and any unsigned char (0....255) value.  It seems to me to say quite clearly
>> that if you have a signed char variable which is negative and you pass it to
>> the ctype function and allow it to be sign-extended by the implicit argument
>> promotion rules then you have supplied an out-of-range value to the
>> function.
>
>This is a real typical bug.  Just recently a bug was found in
>curl-library, quite a popular little library, which calls
>isspace(char).  The bug was missed for a long time, as it is only
>triggered with characters with the MSB set, which do not occur often
>in HTTP headers.

I am reasnably sure that on old SunOS4 systems passing signed char 
to isxxx() was normal and worked. The lookup tables where defined
in such a way that 128 or so entries before the normal table replicated 
the 2nd half.

Snag is it is hard to define such arrays in C.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]