|AWARE [SYSTEMS]||Imaging expertise for the Delphi developer|
|TIFF and LibTiff Mailing List Archive|
LibTiff Mailing List
2009.02.06 04:39 "Re: assertions, and building with DEBUG/NDEBUG", by Phillip Crews
Bob Friesenhahn wrote: > On Thu, 5 Feb 2009, Frank Warmerdam wrote: > >>> 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. >> > > Perhaps open-sourced operating systems are not really production > software. :-) > > My own software contains quite a lot of assertion statements but the > performance boost from removing them was only a few percent. For me, the real problems with leaving assertions in production builds are: 1) Failures do not generate production-quality error messages. 2) The action taken is platform-dependent and not always helpful to users. In a library like libtiff, it is inappropriate to abort the calling program when an assertion is triggered, which a failed assert() does on many platforms. In my code, I use my own macro, which is defined as assert() in debug builds, but in release builds calls an internal logging routine and continues. If a severe problem or crash occurs later because of the bad value, I have information to go on in the log.