develooper Front page | perl.perl5.porters | Postings from February 2011

Re: [perl #84680] POSIX::isdigit() returns 1 for the empty string

Thread Previous | Thread Next
Steve Peters
February 25, 2011 05:32
Re: [perl #84680] POSIX::isdigit() returns 1 for the empty string
Message ID:
On Fri, Feb 25, 2011 at 1:02 AM, Mark Overmeer <> wrote:

> * Steve Peters ( [110225 04:05]:
> > On Tue, Feb 22, 2011 at 10:27 AM, Robert Lang <
> >wrote:
> > > $ perl -MPOSIX -e 'print isdigit(""), "\n"'
> > Thanks for the report.  I do have a fix ready for this, but before I
> commit
> > this, this technically effects all the ifXXX() functions.  Also, in the
> > ext/POSIX/t/posix.t we have...
> The change in C is simple, of course, but it will break existing
> implementations. This is a flaw in the docs, not in the code.

Occasionally, people depend on the behavior of bugs, like people that
depending on Carp being accidentally pulled in with "use warnings".  That
makes it no less of a bug to be fixed.  As the behavior of the function is
not documented regarding what happens when an empty string or undef is
passed in, we still have room to define it.  I'll be sure to add the
documentation fix as well.

Also, looking into the history of the code, it did at one time do exactly
what Linux did when passed an empty string.  It core dumped.

Steve Peters

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About