| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2009.02.05 19:26 "Re: assertions, and building with DEBUG/NDEBUG", by Frank WarmerdamBob Friesenhahn wrote: >> It appears these assertions are being used to call to attention problems >> in these files for developers, and are intended to be compiled out in >> production software. > > Assertions should only be used to detect logic problems in the libtiff > implementation or perhaps the using application. It would be a bug if > an assertion is thrown by libtiff (rather than returning a warning or > error) based on reading a file. Bob, I agree. I have removed some particular assertions in tif_readdir.c now that were really just indicative of corrupt files that were already being trapped appropriately with runtime errors. >> So my question is, is it normal for people building for production >> purposes >> to build with NDEBUG defined? > > I have not heard of a build production process for open-source based > systems which intentionally disables assertions. More than likely they > are disabled in quite a few closed-source applications. It has always been my practice and assumption that assertions should be disabled in production software where performance and appropriate error handling is considered important. >> I am contemplating modifying tiffiop.h to explicitly define NDEBUG if >> DEBUG is not defined, before including assert.h. This would mean that >> assertions are compiled out by default, and only included if DEBUG is >> explicitly requested. I would also change Makefile.vc to define DEBUG >> for >> the debug build case. > > This is a sure-fire way to ensure that there are no bug-reports > regarding thrown assertions. Is that really what we want? Maybe we are > using the assertions incorrectly. As noted, some of the assertions have been removed as inappropriate. However, I still feel it is a questionable practice to leave assertions compiled in to production builds. For now though I'll take no further action in this regard. Best regards, -- ---------------------------------------+-------------------------------------- I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush | Geospatial Programmer for Rent |
|||||||