Unix Technical Forum

Re: [Patch:] restore the native use of isdigit() instead of ap_isdigit() in httpd.

This is a discussion on Re: [Patch:] restore the native use of isdigit() instead of ap_isdigit() in httpd. within the lucky.openbsd.tech forums, part of the OpenBSD category; --> Hmmm. The isdigit man page from the Single Unix Specification on the Open Groups' web site ( www.unix.org ) ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > lucky.openbsd.tech

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-22-2008, 12:16 PM
Daniel Boulet
 
Posts: n/a
Default Re: [Patch:] restore the native use of isdigit() instead of ap_isdigit() in httpd.

Hmmm. The isdigit man page from the Single Unix Specification on the
Open Groups' web site (www.unix.org) declares isdigit as follows:

#include <ctype.h>

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?

-Danny

On 30-Mar-2006, at 12:50 PM, joerg@britannica.bec.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
>> /include/ctype.h:
>>
>> __CTYPE_INLINE int isdigit(int c)
>> {
>> return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c] &
>> _N));
>> }

>
> The important point is that isdigit should not be called with an
> argment
> of type char. As I said, it works on OpenBSD. It does not work on
> other
> systems. isdigit is a documented interface, so it should be used
> correctly, since someone might want to use it on a different system
> later.
>
> Joerg


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:19 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com