From: Bastian Blank Subject: Re: [PATCH] libfsimage: Make it build on NetBSD Date: Sun, 23 Sep 2007 14:55:02 +0200 Message-ID: <20070923125502.GA14313@wavehammer.waldi.eu.org> References: <20070923111256.GA10709@wavehammer.waldi.eu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: Christoph Egger , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Sun, Sep 23, 2007 at 12:48:11PM +0100, Keir Fraser wrote: > The ISO spec is pretty unambiguous: "The c argument is an int, the valu= e of > which the application shall ensure is a character representable as an > unsigned char or equal to the value of the macro EOF. If the argument h= as > any other value, the behavior is undefined." =C2=A77.4 > If we sensibly take 'representable' to mean 'representable with the sam= e > integer value', then the casts are clearly needed for compliance. No. 'representable' means that the value fits in unsigned char (0-255 on common systems). See example 6 of =C2=A75.1.2.3 how the standard uses representable. A cast would force that, if you use unsigned char. > And read glibc's ctype.h -- it goes to some effort to support 'signed c= har' > input, but makes it clear this is "for broken old programs". Yeah, it explicitely does the change which the explicite conversion to unsigned char would do. > This seems to be one of the ugly corners of the C spec where the truth = is > not very palatable. :-) Haha. You want some of i + i++? Bastian --=20 Virtue is a relative term. -- Spock, "Friday's Child", stardate 3499.1