WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] libfsimage: Make it build on NetBSD

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] libfsimage: Make it build on NetBSD
From: Bastian Blank <bastian@xxxxxxxxxxxx>
Date: Sun, 23 Sep 2007 14:55:02 +0200
Cc: Christoph Egger <Christoph.Egger@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sun, 23 Sep 2007 05:55:52 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C31C110B.DEC3%Keir.Fraser@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20070923111256.GA10709@xxxxxxxxxxxxxxxxxxxxxxx> <C31C110B.DEC3%Keir.Fraser@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.13 (2006-08-11)
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 value 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 has
> any other value, the behavior is undefined."

§7.4

> If we sensibly take 'representable' to mean 'representable with the same
> 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 §5.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 char'
> 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

-- 
Virtue is a relative term.
                -- Spock, "Friday's Child", stardate 3499.1

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel