2017.03.17 14:29 "[Tiff] TIFFSetErrorHandler vs TIFFSetErrorHandlerExt", by Dinesh Iyer

2017.03.17 21:08 "Re: [Tiff] TIFFSetErrorHandler vs TIFFSetErrorHandlerExt", by Bob Friesenhahn

On Fri, 17 Mar 2017, rleigh@codelibre.net wrote:

Could I suggest a perhaps controversial but useful solution for handling errors, which might be worth your consideration.

If the libtiff core were to use a C++ TIFF class reporting errors via exceptions, it would be possible for this to be wrapped by the existing C API calling the C++ code in a try/catch block and reporting any thrown errors via the handlers. Or direct use by C++ code without any of that

Unfortunately, throwing C++ exceptions through C code is not portable. It would require that the using program to be linked using the C++ compiler. The built library would only support one C++ compiler (perhaps just one of several C++ dialects supported by the same compiler) due to C++ compiler run-time libraries and name mangling.

I like C++ but libtiff needs to remain a plain C library.

The libtiff API can be improved to make it easier for C++ and threaded programs to use it more effectively.

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