[FFmpeg-devel] [PATCH 1/4] lavd: add list devices API

Nicolas George george at nsup.org
Fri Feb 14 08:46:56 CET 2014


Le quintidi 25 pluviôse, an CCXXII, Don Moir a écrit :
> I suppose if user does something dumb like pass in a null context
> and av_assert1 ends up being defined as av_assert1(cond)((void)0) it
> will crash unepectedly.

You are slightly wrong: it will crash expectedly, not unexpectedly. You can
then fix your program.

Returning an error would mean half the programs ignoring it and crashing at
a random point later.

I consider errors are meant for cases that can not be avoided trivially by
the caller: the documentation implicitly tells not to give a NULL context,
then don't. If you can not predict that the context will be non-NULL, there
is something seriously wrong in your program, but you can still add a check.

Regards,

-- 
  Nicolas George


More information about the ffmpeg-devel mailing list