From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31251 invoked by alias); 8 Oct 2004 13:13:21 -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 31241 invoked from network); 8 Oct 2004 13:13:20 -0000 Received: from unknown (HELO NUTMEG.CAM.ARTIMI.COM) (217.40.111.177) by sourceware.org with SMTP; 8 Oct 2004 13:13:20 -0000 Received: from mace ([192.168.1.25]) by NUTMEG.CAM.ARTIMI.COM with Microsoft SMTPSVC(6.0.3790.0); Fri, 8 Oct 2004 14:12:57 +0100 From: "Dave Korn" To: "'Nick Ing-Simmons'" , Cc: , "'Morten Welinder'" Subject: RE: signed vs unsigned pointer warning Date: Fri, 08 Oct 2004 13:32:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: <20041008130623.9516.4@llama.elixent.com> Message-ID: X-OriginalArrivalTime: 08 Oct 2004 13:12:57.0048 (UTC) FILETIME=[87272580:01C4AD38] X-SW-Source: 2004-10/txt/msg00331.txt.bz2 > -----Original Message----- > From: Nick Ing-Simmons [mailto:nick@ing-simmons.net] > Sent: 08 October 2004 14:06 > >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. Well, you don't, you just define a "type * const" pointer to the 128'th entry of the real underlying, e.g. instead of saying unsigned char isXXX_flags_array[256] you say static unsigned char __isXXX_flags_array[256]; unsigned char * const isXXX_flags_array = &__is_flags_array[128]; Or at any rate, I use that idiom quite a lot. cheers, DaveK -- Can't think of a witty .sigline today....