|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] [PATCH] libfsimage: Make it build on NetBSD
On 23/9/07 12:12, "Bastian Blank" <bastian@xxxxxxxxxxxx> wrote:
> On Fri, Sep 21, 2007 at 02:39:46PM +0200, Christoph Egger wrote:
>> - if (!*dirname || isspace (*dirname))
>> + if (!*dirname || isspace ((uint8_t)*dirname))
>
> According to C99, the definition is "int isspace(int c)". Even char can
> be converted implicitely to int. Which problem do you intend to fix with
> that? If this functions are incorrectly defined on BSD, fix that their.
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."
If we sensibly take 'representable' to mean 'representable with the same
integer value', then the casts are clearly needed for compliance. This
interpretation even makes some sense, since it explicitly disallows
collision between character code 0xff and EOF (usually -1).
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".
This seems to be one of the ugly corners of the C spec where the truth is
not very palatable. :-)
-- Keir
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|