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

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

Thread Previous | Thread Next
Nick Ing-Simmons
December 19, 2000 13:27
Re: strtoul (was Re: [PATCH] Fcntl constants speedup)
Message ID:
Nicholas Clark <> writes:
>> 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. 

So was I - looks_like_number is doing most of the work already, having it 
tally up the digits into an UV as it goes makes a lot of sense to me.
It is less clear that we want the hassle of the NV case.
(Getting the round-decimal-to-binary correct is a pain in the non-integer
case - somewhere at work I have some papers on the "right" way to do it
that I got last time I was involved in writing C libraries.)

>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
Nick Ing-Simmons

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