[FFmpeg-devel] [PATCH] examples/muxing: improve error messages.

Clément Bœsch ubitux at gmail.com
Thu Jan 3 00:03:15 CET 2013


On Wed, Jan 02, 2013 at 11:58:42PM +0100, Stefano Sabatini wrote:
> On date Wednesday 2013-01-02 17:47:32 +0100, Nicolas George encoded:
> > Le tridi 13 nivôse, an CCXXI, Stefano Sabatini a écrit :
> > > LGTM.
> > 
> > Thanks, pushed.
> > 
> > > BTW we should avoid to exit() from functions, return an error code
> > > instead and do proper cleanup in the calling function (at that point
> > > error reporting could be factorized).
> > 
> 
> > The purpose of the examples is to illustrate the API, not to educate with
> > good coding practices, and direct exit() is completely acceptable in quite a
> > lot of situations.
> > 
> > Therefore, eliminating exit() is not a goal in itself: if it makes the code
> > simpler and/or more readable, 100% ok. If it does not make the code less
> > readable, why not, but there are more urgent issues.
> 
> On the other hand I bet that people want to integrate the code into
> their programs, so having a modular design will help integration.

IMO the most important argument in favor of eliminating exit is that it
shows the users how the cleanup must be done with our API; typically, if
you need to check for NULL pointer before a free/destroy/close function.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130103/956bdf84/attachment.asc>


More information about the ffmpeg-devel mailing list