NetBSD-Bugs archive

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

Re: lib/49429: Import strtonum(3)



Kamil Rytarowski wrote
> In my opinion this should be considered differently:
> - if someone wants safe atoi(3) replacement will switch to strtonum(3),
> - if someone wants to handle cases with trailing characters, will use atoi(3),
> - if someone wants to handle special cases (different base, complex error handling) will stay with strtol-like functions
>
> I think that some developers want to consider strtonum(3) as a strtol(3) (or sscanf(3)) replacement, what is wrong. And here is the key of our misunderstanding (safe atoi on steroids vs 'orchestra' function).
>

So to add my last word here. If we could consider strtonum(3) this way as a safe atoi(3) replacement (then there is no need to "fix" the API... as atoi(3) returns just int), please give me green light and then:
- I will kill all occurrences of strtonum.c in our code-base,
- Import strtonum(3),
- Global switch to our strtonum(3).

I need strtonum(3) in pkgsrc as well, so I after merging the code with src/ I will propose a patch for pkgsrc (libnbcompat).

BTW. It's not a valid argument, but for Lua developers, strtonum is an idiom of a function converting strings to numbers.


Home | Main Index | Thread Index | Old Index