tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: strtonum(3) from OpenBSD?

On Friday 26 June 2009 06:15:11 James K. Lowden wrote:
> Marc Balmer wrote:
> > OpenBSD has the strtonum(3) function to reliably convert string values
> > to an
> > integer since the 3.6 release.
> Well, I'm late to the party.  Maybe I get the last word?

No :P

> I don't understand why atoi() keeps getting reinvented when we have a
> completely standard, easily extended alternative: sscanf(3).  Whatever
> shortcomings it has can be rectified without changing its signature by
> extending its mini-language.

I, for one, agree with James and use sscanf quite freely.
I am opposed to strtonum being added because of reasons already discussed. If 
it was a widely accepted standard - and say mandated by POSIX - then I'd be 
all for it, but it's not so I'm not.



Home | Main Index | Thread Index | Old Index