From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17509 invoked by alias); 8 Oct 2004 17:08: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 17498 invoked from network); 8 Oct 2004 17:08:55 -0000 Received: from unknown (HELO kiruna.synopsys.com) (198.182.44.80) by sourceware.org with SMTP; 8 Oct 2004 17:08:55 -0000 Received: from mother.synopsys.com (mother.synopsys.com [146.225.100.171]) by kiruna.synopsys.com (Postfix) with ESMTP id 5A5C1F2AD; Fri, 8 Oct 2004 10:08:37 -0700 (PDT) Received: from piper.synopsys.com (localhost [127.0.0.1]) by mother.synopsys.com (8.9.1/8.9.1) with ESMTP id KAA05470; Fri, 8 Oct 2004 10:08:54 -0700 (PDT) Received: (from jbuck@localhost) by piper.synopsys.com (8.11.6/8.11.6) id i98H8sT02225; Fri, 8 Oct 2004 10:08:54 -0700 X-Authentication-Warning: piper.synopsys.com: jbuck set sender to Joe.Buck@synopsys.com using -f Date: Fri, 08 Oct 2004 17:59:00 -0000 From: Joe Buck To: Nick Ing-Simmons , jamie@shareable.org, gcc@gcc.gnu.org, "'Morten Welinder'" , Dave Korn Subject: Re: signed vs unsigned pointer warning Message-ID: <20041008100853.A2207@synopsys.com> References: <20040922161751.B4F6A1422D53@darter.rentec.com> <20040926192142.GA29842@mail.shareable.org> <20040926192142.GA29842@mail.shareable.org> <20041008130623.9516.4@llama.elixent.com> <20041008091714.A1695@synopsys.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from prj@po.cwru.edu on Fri, Oct 08, 2004 at 12:26:35PM -0400 X-SW-Source: 2004-10/txt/msg00362.txt.bz2 On Fri, Oct 08, 2004 at 12:26:35PM -0400, Paul Jarc wrote: > Joe Buck wrote: > > Why can't an implementation define isxxx(c) to return something like > > table_lookup[(unsigned)(c)] > > ? > > Assuming EOF==-1, that fails to distinguish between EOF and character > 255 (as does the 384-element table in the case where a signed char is > passed). The ctype macros are supposed to accept EOF as well as > unsigned char values. No, (unsigned)-1 does not turn into 255, it turns into a very large number. You cannot store EOF in a char. Here's a bug fix: table_lookup[1U+(unsigned)(c)] Now EOF goes into slot 0.