On 15 Jul 2015, at 01:02, Xin Li <delp...@delphij.net> wrote:
> 
> My only concern with strtonum() is that it's English only.

Given that strtonum() wraps strtoll, it ought to support whatever the current 
locale is (assuming that the program calls setlocale() before calling 
strtonum(), otherwise it will use the C locale[1]).  Or do you mean that the 
error messages are not localised?

David

[1] I would strongly advise against calling strtonum() or strtoll(), rather 
than strtoll_l() from a library, as it is impossible to specify in a 
potentially multi-threaded context whether you’re currently using a 
human-friendly or a machine-friendly number representation.  In a 
single-threaded application, it’s probably fine as long as *all* of your number 
parsing is either from a user or from a machine-parsable file (and all of your 
output is similar, or you’re explicitly setting the locale before each call).  
Given that strtonum() is non-standard anyway, we should probably add a 
strtonum_l() that takes a locale_t and a number base.
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to