Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Sep 2009 12:40:03 +0400
From:      Andrey Chernov <ache@nagual.pp.ru>
To:        "Simon L. Nielsen" <simon@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r196752 - head/lib/libc/stdtime
Message-ID:  <20090902084002.GA17325@nagual.pp.ru>
In-Reply-To: <20090902070808.GA1290@arthur.nitro.dk>
References:  <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
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/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090902084002.GA17325>