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

Andrey Chernov ache at nagual.pp.ru
Wed Sep 2 08:51:09 UTC 2009


On Wed, Sep 02, 2009 at 09:08:09AM +0200, Simon L. Nielsen wrote:
> > Log:
> >   Use (unsigned char) cast for ctype macro
> 
> Acording to the manual page and the C standard book I have, isdigit()
> takes an int for an argument, so why change this?

Not exactly that. From our manual page:

"The value of the argument must be representable as an unsigned char or
the value of EOF."

Signed char (automatically casted to int in expression even without direct 
(int) cast) passed to any ctype macro potentically may cause a lot of 
problems, such as: incorrect char class detection or even core dump in 
some systems.

This is due to automatic sign extension of 8bit (if present).

-- 
http://ache.pp.ru/


More information about the svn-src-all mailing list