From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3199 invoked by alias); 8 Oct 2004 17:28:03 -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 3188 invoked from network); 8 Oct 2004 17:28:02 -0000 Received: from unknown (HELO mail.shareable.org) (81.29.64.88) by sourceware.org with SMTP; 8 Oct 2004 17:28:02 -0000 Received: from mail.shareable.org (localhost [127.0.0.1]) by mail.shareable.org (8.12.8/8.12.8) with ESMTP id i98HS181013984; Fri, 8 Oct 2004 18:28:01 +0100 Received: (from jamie@localhost) by mail.shareable.org (8.12.8/8.12.8/Submit) id i98HS1YG013982; Fri, 8 Oct 2004 18:28:01 +0100 Date: Fri, 08 Oct 2004 18:24:00 -0000 From: Jamie Lokier To: Joe Buck Cc: Nick Ing-Simmons , gcc@gcc.gnu.org, "'Morten Welinder'" , Dave Korn Subject: Re: signed vs unsigned pointer warning Message-ID: <20041008172801.GB13758@mail.shareable.org> 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> <20041008100853.A2207@synopsys.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041008100853.A2207@synopsys.com> User-Agent: Mutt/1.4.1i X-SW-Source: 2004-10/txt/msg00365.txt.bz2 Joe Buck wrote: > 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. The trouble is that char 255 (or char -1 depending on your point of view) _might_ also go into slot 0, depending on the type of c and how it was passed. Do the standards require anything about the result of is*(EOF), or do the functions simply have to accept that as an argument? In any case, code which writes: char c = ... ; ... if (isspace(c)) { ... } Surely deserves a warning from the compiler, just because it'll fail on some OSes. -- Jamie