develooper Front page | perl.perl5.porters | Postings from December 2000

Re: strtoul (was Re: [PATCH] Fcntl constants speedup)

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
December 19, 2000 08:56
Subject:
Re: strtoul (was Re: [PATCH] Fcntl constants speedup)
Message ID:
20001219165655.A2827@plum.flirble.org
On Tue, Dec 19, 2000 at 04:39:32PM +0000, Nick Ing-Simmons wrote:
> Jarkko Hietaniemi <jhi@iki.fi> writes:
> >> >As long as we don't mind losing locale based number grouping (whatever
> >> >that is, but it's compiled in in my copy of strtol - I disassembled it
> >> >and can see the pattern of code that's doing it)
> >> 
> >> We only loose "locale based number grouping" for things that "look
> >> like numbers" in perl's view - so do we really loose anything?
> >
> >We gain more warnings if the system's strtoul() didn't use to complain
> >about things like "1,234,567" and nicely returned 1234567.  Search
> >perllocale for 'grouping', and see localeconv(3).
> 
> But I don't see where looks_like_number() lets things with ',' in through
> to be converted ... 

I think that I was unclear. Jarkko was suggesting roll our own strtol
(etc) for perl6.
I was only thinking in terms of roll our own routine in 5.7 for sv_2[iun]v
to call. And sv_2[iun]v only calls strtod if looks_like_number thinks
that something looks like its idea of a number, which for integers is
/^\s*[-+]?[0-9]+\s*$/  (if I have my regexp correct, but the important
bit is no commas, (and hardcoded '0' to '9' instead of \d (and a fanatical
loyalty to the Pope))

So I think that this means that sv_2[iun]v don't currently "do" locales.
So roll-ones-own just for them doesn't need to either.

but I think wait until HP UX and Irix are happy before doing more.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About