From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19440 invoked by alias); 22 Sep 2004 16:17:56 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 19395 invoked from network); 22 Sep 2004 16:17:53 -0000 Received: from unknown (HELO ram.rentec.com) (192.5.35.66) by sourceware.org with SMTP; 22 Sep 2004 16:17:53 -0000 Received: from darter.rentec.com (darter.rentec.com [172.26.132.158]) by ram.rentec.com (8.12.9/8.12.1) with ESMTP id i8MGHpU6013003; Wed, 22 Sep 2004 12:17:52 -0400 (EDT) Received: by darter.rentec.com (Postfix, from userid 414) id B4F6A1422D53; Wed, 22 Sep 2004 12:17:51 -0400 (EDT) To: gcc@gcc.gnu.org From: terra@gnome.org (Morten Welinder) Cc: dk@artimi.com Subject: RE: signed vs unsigned pointer warning Message-Id: <20040922161751.B4F6A1422D53@darter.rentec.com> Date: Wed, 22 Sep 2004 16:43:00 -0000 X-SW-Source: 2004-09/txt/msg01287.txt.bz2 Dave Korn writes: > Until you try indexing an array with an 8-bit high ASCII char, of course. > Then things become radically different. I've known buggy ctype > implementations that have failed on this (ASCII > 127 being signed negative > and the ctype function accidentally indexing memory space before an array > full of ctype result flags). [/me gathers soapbox] I bet you have. In fact *ALL* ctype implementations will fail.[*] That includes glibc What glibc does is to *mostly* work around buggy programs that send (explicitly or implicitly) signed characters to, say, isprint. It does not always work, though, so glibc really did you a disservice. It is really hard to get people to fix their programs. It does not work for (signed char)-1 if EOF==-1. It cannot work as two different results are required for the same argument value. Solaris does the array[arg] thing you speak about. It isn't buggy. The caller is, and, IMHO the standard is. Morten [*] Assuming (char)EOF==EOF, which it will be with signed characters and EOF==-1.