From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17854 invoked by alias); 10 Apr 2007 21:52:13 -0000 Received: (qmail 17843 invoked by uid 22791); 10 Apr 2007 21:52:12 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 10 Apr 2007 22:52:09 +0100 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l3ALq4CF030563; Tue, 10 Apr 2007 17:52:04 -0400 Received: from post-office.corp.redhat.com (post-office.corp.redhat.com [172.16.52.227]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l3ALq4nv014788; Tue, 10 Apr 2007 17:52:04 -0400 Received: from greed.delorie.com (vpn-14-8.rdu.redhat.com [10.11.14.8]) by post-office.corp.redhat.com (8.12.11.20060308/8.11.6) with ESMTP id l3ALq3Ev015354; Tue, 10 Apr 2007 17:52:03 -0400 Received: from greed.delorie.com (greed.delorie.com [127.0.0.1]) by greed.delorie.com (8.13.8/8.13.8) with ESMTP id l3ALq29s012698; Tue, 10 Apr 2007 17:52:02 -0400 Received: (from dj@localhost) by greed.delorie.com (8.13.8/8.13.8/Submit) id l3ALq0Ai012688; Tue, 10 Apr 2007 17:52:00 -0400 To: Daniel Jacobowitz Cc: gdb-patches@sourceware.org Subject: Re: Patch for isdigit/isalpha/etc. macro arguments References: <200704102116.OAA21675@hpsje.cup.hp.com> <20070410212125.GG2056@caradoc.them.org> From: DJ Delorie Date: Tue, 10 Apr 2007 21:52:00 -0000 In-Reply-To: <20070410212125.GG2056@caradoc.them.org> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-04/txt/msg00117.txt.bz2 Daniel Jacobowitz writes: > I think we should decide whether this constitutes a Real Problem, > and whether we care about it, before we do this. It seems that > passing a char to isfoo is not portable, although I could not tell for > sure from the discussion whether ISO C requires it to work. ISO C requires you to pass 0..255 or EOF, nothing else, to is*(). If the char might be signed, one must either cast it to unsigned char or mask it with 0xff before using it as a subscript, else one risks a negative subscript. Negative values aren't guaranteed to work with is*(), although some implementations put a second copy of the ctype data array in front of the normal one to accomodate values in the range -128..-1. I suspect this is mostly to keep uninformed programmers from bothering the mailing lists with complaints about is*() not working when really it's the programmer's fault.