2008.12.17 20:54 "[Tiff] Deleting tags from a directory", by Frank Warmerdam

2009.02.06 17:08 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Bob Friesenhahn

assert() isn't very friendly even to developers. really we should only be using it where it is "impossible" for the test to fail, and there is no way to sanely recover if it does. If you are planning to drop that test for

Assert is like an electric cattle-prod for libtiff developers to motivate them to fix problems. For example, a common assertion is for a function to test if a passed pointer is not NULL prior to using it. If the passed pointer is NULL, then there must have been a logic error in some other part of the code (e.g. not checking the value from malloc/realloc) or memory containing the pointer was overwritten to zero. I have several systems here which will dereference through a null pointer without automatic assertion so an explicit assertion is valiable.

If problems which should really be assertions are instead reported as a warning or even an error, then it is likely that most users will not report the problem, and so it won't be fixed. In some cases written files may become corrupted, potentially at huge loss to the user. Clearly a thrown assertion is preferable over writing a corrupt file. The vast majority of users who encounter a problem do not report it to responsible parties.

At the moment there are 363 assert statements in libtiff. Investigation will likely show that most of these assert statements have been in the code for many years, without causing any harm.

It seems that Joris and perhaps other libtiff developers have a somewhat different idea of assert than that it is like an electric cattle prod to get serious logic problems noticed and fixed ASAP. Asserts which validate data read from a file are a serious bug. Speculative asserts are a serious bug.

The libtiff project cuts alpha and beta packages and encourages people to test with them in order to discover any problems (such as thrown assertions) prior to release.

Bob
======================================
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/