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: Bastian Blank <bastian@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] libfsimage: Make it build on NetBSD
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Sun, 23 Sep 2007 14:44:50 +0100
Cc: Christoph Egger <Christoph.Egger@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sun, 23 Sep 2007 06:40:55 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070923125502.GA14313@xxxxxxxxxxxxxxxxxxxxxxx>
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acf95+l+KCmW1mnbEdyrigAWy6hiGQ==
Thread-topic: [Xen-devel] [PATCH] libfsimage: Make it build on NetBSD
User-agent: Microsoft-Entourage/11.3.6.070618
On 23/9/07 13:55, "Bastian Blank" <bastian@xxxxxxxxxxxx> wrote:

>> 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.

Well, actually that's what I meant but may have worded poorly. Yes, the
range of an unsigned char is [0, 255] and hence no negative integer can be
represented. So passing a negative char to a ctype function is invalid.

>> 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.

Actually it casts to int, at least in my installed glibc. Thus the sign is
maintained, and allowance is made by glibc for negative indexing into its
ctype array. I interpret this as a kludge to let old programs and lazy
programmers do the obvious thing in spite of the spec.

 -- Keir



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