svn commit: r196752 - head/lib/libc/stdtime

Joerg Sonnenberger joerg at britannica.bec.de
Thu Sep 3 14:04:27 UTC 2009


On Thu, Sep 03, 2009 at 03:25:26PM +0200, Dag-Erling Smørgrav wrote:
> > This is actually not good enough. ISO C doesn't specify whether plain
> > char is signed or unsigned.
> 
> This is FreeBSD.  Our char is signed.  On systems where it isn't (IRIX
> is the only one I know of), the cast is a no-op.

GCC's default for ARM is unsigned. Just to name the most popular
platform. I don't know if FreeBSD has local patches, but I expect a
non-trivial amount of code is ported from/to ARM systems as well.

> 
> > Also, isascii is the only exception to this rule, so the change for that
> > is wrong.
> 
> No.  The fact that isascii() accidentally returns the correct answer
> even in the absence of a cast is irrelevant.  Passing a signed char to
> isascii() invokes undefined behavior.

To quote SUS:

The isascii() function shall return non-zero if c is a 7-bit US-ASCII
character code between 0 and octal 0177 inclusive; otherwise, it shall
return 0.

Joerg


More information about the svn-src-all mailing list