|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] [PATCH] libfsimage: Make it build on NetBSD
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
|
|
|
|
|