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