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

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

Thread Previous | Thread Next
Nicholas Clark
December 19, 2000 08:56
Re: strtoul (was Re: [PATCH] Fcntl constants speedup)
Message ID:
On Tue, Dec 19, 2000 at 04:39:32PM +0000, Nick Ing-Simmons wrote:
> Jarkko Hietaniemi <> 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About