tech-userlevel archive

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

Re: strtonum(3) from OpenBSD?




Am 24.06.2009 um 20:24 schrieb Thor Lancelot Simon:

On Wed, Jun 24, 2009 at 08:22:11AM +0200, Marc Balmer wrote:

Returning an error *string* is so profoundly bogus I have trouble
imagining that anyone with more than a few weeks' experience
programming
in C doesn't see why.

with even more experience in C you get to learn to actually look
at implementations.  In the strtonum(3) case, you will spot that
it actually sets errno _and_ provides a string value which can be
used for most (simple and english) error message.

The function generates errno values which can't be used to
distinguish the error cases distinguished by the text strings,
which are (absurdly) specified in its manual page as part of the
API (in other words, the function as specified is inherently
non-localizable).

If it didn't set errno at all, it would be an example of really,
really bad API design.  Since it does (but doesn't do so usefully),
it's merely an example of bad API design.

I think this is not correcz.


This is NetBSD.  Cleanliness matters.  I'm opposed to adding this
API to the system in its current form.

And no, I don't care what the implementation looks like so long
as the defined API is so broken.  And -- no matter how loud and
outraged you get -- it's unlikely you'll persuade me otherwise.


I did neither get loud nor outraged.  I only asked why it was not there
and if it had been considered before.

You in your reply only showed that  did not read the manpage neither
look at the code...

I think I did not suggest to add it right now, otherwise I would have
provided a diff for it.

for me this issue is solved.  I don't need strtonum(3) in a library
right now.

si tacuisses....

Thor



Home | Main Index | Thread Index | Old Index