From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17100 invoked by alias); 9 Apr 2007 12:57:28 -0000 Received: (qmail 17090 invoked by uid 22791); 9 Apr 2007 12:57:27 -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; Mon, 09 Apr 2007 13:57:25 +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 l39CvNEs028748; Mon, 9 Apr 2007 08:57:23 -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 l39CvM2w010031; Mon, 9 Apr 2007 08:57:22 -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 l39CvLBS006203; Mon, 9 Apr 2007 08:57:22 -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 l39CvLt3012029; Mon, 9 Apr 2007 08:57:21 -0400 Received: (from dj@localhost) by greed.delorie.com (8.13.8/8.13.8/Submit) id l39CvKD5012026; Mon, 9 Apr 2007 08:57:20 -0400 To: Andreas Schwab Cc: gdb-patches@sourceware.org Subject: Re: Patch for isdigit/isalpha/etc. macro arguments References: From: DJ Delorie Date: Mon, 09 Apr 2007 12:57:00 -0000 In-Reply-To: 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/msg00066.txt.bz2 Andreas Schwab writes: > How can it distinguish EOF from '\377'? EOF is -1 and '\377' is 255; they're different values. Functions that may return EOF return an int, not a char, and you should not cast that value to char before checking for EOF. The is*() macros take an int because there are 257 different values (-1..255) that they must accept, not 256. In many cases, programmers use 'char' to hold the result of, for example, fgetc(), and the warning from gcc is valid (although indirect) because they've lost the EOF marker.