[Ffmpeg-devel] Re: [PATCH] MXF demuxer

Uoti Urpala uoti.urpala
Tue Jul 18 01:22:59 CEST 2006


On Tue, 2006-07-18 at 01:02 +0200, Baptiste Coudurier wrote:
> > If the file contains values not allowed by the spec you should diagnose
> > that as invalid input and return an error. It's not reasonable to assume
> > that the user would demux "trusted" files only, and so killing the
> > program because of invalid input is not appropriate.
> 
> If I follow your principle, asserts are just useless. I shall always
> check values and return -1 in every situation, now I can grep for assert

Not every situation. It's not reasonable to assume that the user would
only try to demux files that the certain to be valid, so you have to
explicitly check that, and asserts are not appropriate. Invalid files
are part of the _expected_ input set from the program's point of view.
An appropriate use of asserts would be for example to check the internal
logic of the program, say check an array index against array size when
it should be valid for any user input but the logic is complex enough
that absence of bugs is not obvious.

> I agree with you in principle of course. Im just lost in what is a good
> "assert" and Im afraid that will start another flame or troll.

I don't think there is any significant disagreement about this aspect of
using asserts.





More information about the ffmpeg-devel mailing list