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.