From: Ian Scott <ian.scott@st...> - 2003-02-06 17:14:49
Some colleagues who write code for medics, clinical scientists, and other
end users are having problems with asserts and aborts.
They can't turn off all the error checking for Medical/Clinical good
practice reasons, but "Unhandled Memory Exception" messages aren't ideal.
Some of them have used specialist Win32 and MSVC API's to intercept the
abort, and throw an exception instead. They would like a cross platform
The ideal error reporting mechanism for them is exception throwing. However,
we have avoided using this in core VXL because of compatibility and
I propose a solution, that we are vaguely thinking about implementing in
1. Code in vnl should never call vcl_abort() or assert(), but instead use
vnl_abort() and vnl_assert().
2. In the absence of a compiler setting (e.g. -DVXL_USE_EXCEPTIONS
or -DVNL_USE_EXCEPTIONS) vnl_abort() will call vcl_abort, and vnl_assert
acts like assert().
3. If the user wants to use exceptions, then calling vnl_abort() or failing
vnl_assert() will throw a vnl_exception ( or a derivative thereof)
4. vnl_exception may or may not be derived from vcl_exception.
5. We could attempt to respect the semantic division of exceptions provided
by the STL (vcl_logic_error and vcl_runtime_error) - though Stroustrup is
unconvinced by the usefulness of the framework.
6. It would be very useful if the exceptions contained a stack trace at the
time of its throwing. This is very useful for understanding problems
reported by end-users. It could be implemented on those platforms that
7. We would not immediately make all the code exception safe, but may fix
any significant problems we come across.
Does anyone have any comments, or suggestions?
Get latest updates about Open Source Projects, Conferences and News.