[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: libcodecs(3), take 4
On Oct 2, 2010, at 5:38 15AM, David Laight wrote:
> On Sat, Oct 02, 2010 at 08:13:25AM +0200, Alistair Crooks wrote:
>> Hi Uebayashi-san,
>> Thanks for your feedback.
>> On Sat, Oct 02, 2010 at 02:42:02PM +0900, Masao Uebayashi wrote:
>>> Usually libraries don't print error messages to stderr, nor exit.
>> That's true for some libraries, but not for all of them. At the same
>> time, printing error messages is far superior to the practise of
>> returning enumerated error values (like regexp libraries), or stacking
>> them up and vomiting them up at a later stage.
> If libraries are going to write to stdout or stderr it really must
> be a documented part of their interface.
And preferably not done, because that assumes a particular model of operation.
If the calling program is a daemon that uses syslog to write to a log file --
which will be processed by another daemon -- on a remote machine, stderr output
is pretty useless; it may not even go anywhere other than /dev/null.
I'd vote for (a) a error return indicator; (b) a numeric value akin to errno
describing the particular error, and (c) a formatted string with the text that
you think should be written out. If there is only ever one variable parameter
in those strings, another character string with that value is also a good idea.
(Note, of course, that I haven't looked at all at what the library does, so
this part may be completely off base.... But I stand by the first paragraph.)
--Steve Bellovin, http://www.cs.columbia.edu/~smb
Main Index |
Thread Index |