[Ffmpeg-devel] [PATCH] assert.h cleanup

Michael Niedermayer michaelni
Mon Dec 5 21:27:24 CET 2005


On Mon, Dec 05, 2005 at 04:06:55PM +0100, Guillaume Poirier wrote:
> Gildas Bazin wrote:
> > Hi,
> > 
> > Here is a patch that removes the explicit inclusion of assert.h and undef of 
> > NDEBUG in a big bunch of files. assert.h is already included by common.h so 
> > there isn't any need to have it included anywhere else.
> Some of these hunks is just dead code removal, so I don't see how they
> could be controversial :)
> > This patch allows compiling the code without asserts (with the help of 
> > --disable-debug) which does actually make a bit of difference in 
> > performance for the h264 codec for instance.
> Aren't asserts a good thing(tm) by allowing fatal errors to be caught
> and prevent the library from doing stupid things?
> In any case, I think that if you alias assert deactivation to disabling
> debugging symbols, it's not a good idea. Now, maybe current code already
> features this kind of aliasing, I don't know.

IIRC currently some asserts are always enabled and the rest is always disabled
the patch is not acceptable
one thing which could be done, is to split asserts into several types
security related asserts (failure could lead to exploit) (security_assert())
asserts in normal code (slow_assert())
asserts in speed critical code (fast_assert())

with these we could disable fast&slow for the small binary case
disable only fast for "release builds" and leave all enabled for "debug builds"

now its not nearly as much work to put them into categories as its often
a "all asserts in file X are not speed critical" type of thing



More information about the ffmpeg-devel mailing list