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

Re: DeviceKit and /usr

Josselin Mouette <joss@debian.org> writes:
> Le mardi 08 septembre 2009 à 13:00 +0200, Bjørn Mork a écrit : 

>> Trusting a library to do all your error handling and cleanup is not
>> good style IMHO.  In addition to the lack of self-documenting source,
>> it often leave you with the meaningless generic error messages some
>> OSes are so full of.  Applications doing their own error handling are
>> in a much better position to provide specific meaningfull error
>> messages to the user.

> If a memory allocation failed while you were manipulating strings (an
> operation with very low requirements), you are not likely to obtain
> enough memory to even display an error message.

I'm with Josselin on this.  The daemons I write die when they run out of
memory for things like string manipulation.  The library that I use for
such error handling supports a termination routine that can be called in
that case to do an emergency shutdown of resources, but the daemon still
then exits.

Libraries are another matter, of course, and should instead return failure
codes to the calling application for the application to deal with as it
choses.  But applications should feel free to terminate when they can't
even allocate small amounts of memory for string manipulation.

Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>

Reply to: