[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Patch:] restore the native use of isdigit() instead of ap_isdigit() in httpd.
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: Re: [Patch:] restore the native use of isdigit() instead of ap_isdigit() in httpd.
- From: Daniel Boulet <danny_(_at_)_savrola_(_dot_)_com>
- Date: Thu, 30 Mar 2006 15:21:29 -0700
Hmmm. The isdigit man page from the Single Unix Specification on the
Open Groups' web site (www.unix.org) declares isdigit as follows:
int isdigit(int c);
This documentation for the isdigit interface would appear to allow
the parameter to be a char since chars can certainly be cast to ints
without any loss of information.
I will say that arguing that one should pass unsigned char's to
isdigit to ensure portability across even antique environments that
do not adhere to the roughly ten year old Single Unix Specification
makes a certain amount of sense. Arguing that one should not pass
chars to isdigit because it violates isdigit's documented interface
is the part that I'm having trouble with.
There is a caveat on the Open Group's man page which reads as follows:
The functionality described on this reference page is aligned with
the ISO C standard. Any conflict between the requirements described
here and the ISO C standard is unintentional. This volume of IEEE Std
1003.1-2001 defers to the ISO C standard.
I don't have a copy of the ISO C standard. Could someone who has
access to the ISO C standard check to see how it defines isdigit?
On 30-Mar-2006, at 12:50 PM, joerg_(_at_)_britannica_(_dot_)_bec_(_dot_)_de wrote:
On Thu, Mar 30, 2006 at 02:44:19PM -0500, Daniel Ouellet wrote:
What I did is to check how it was process by the macro in the
__CTYPE_INLINE int isdigit(int c)
return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] &
The important point is that isdigit should not be called with an
of type char. As I said, it works on OpenBSD. It does not work on
systems. isdigit is a documented interface, so it should be used
correctly, since someone might want to use it on a different system
Visit your host, monkey.org