This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: signed vs unsigned pointer warning
- From: Nick Ing-Simmons <nick at ing-simmons dot net>
- To: jamie at shareable dot org
- Cc: gcc at gcc dot gnu dot org,"'Morten Welinder'" <terra at gnome dot org>,Dave Korn <dk at artimi dot com>
- Date: Fri, 08 Oct 2004 14:06:23 +0100
- Subject: Re: signed vs unsigned pointer warning
- References: <20040922161751.B4F6A1422D53@darter.rentec.com><NUTMEGODkUqESudbgsy00000021@NUTMEG.CAM.ARTIMI.COM><20040926192142.GA29842@mail.shareable.org>
- Reply-to: Nick Ing-Simmons <nick at ing-simmons dot net>
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.