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

[ Available lists | Index of svn-src-all | Month of Sep 2009 | Week of 2 Sep 2009 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Andrey Chernov <ache@nagual.pp.ru>
Date
2 Sep 2009 08:51:08
Subject
Re: svn commit: r196752 - head/lib/libc/stdtime
Message-ID
20090902084002.GA17325@nagual.pp.ru


[ Hide this part ]
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/

Elapsed time: 0.254 seconds