PDA

View Full Version : Have CL_Error inherit from std::exception



SnT2k
11-03-2007, 02:47 AM
I think it would be a wide idea for CL_Error to inherit from std::exception to make catching of exceptions a tad bit easier. I don't think it's that much of a hassle. Just have CL_Error inherit from std::exception and implement the function:

const char* what() const throw() { return message.c_str(); }
And implement a non-throwing destructor:

~CL_Error() throw() {}

Magnus Norddahl
06-23-2008, 11:54 PM
Just noticed this old request.

CL_Error (CL_Exception in 0.9) does not inherit from std::exception mostly for historic reasons. The problem is that standard compliance amongst C++ compilers have generally been fairly poor when it comes to certain details. I believe that in the older Visual C++ compilers std::exception was not defined (although I could be wrong). Right now we don't derive from it to avoid possible problems with earlier versions of C++ compilers.

rombust
06-24-2008, 06:57 AM
<stdexcept> exists on Visual Studio 7.0.9955, so i would not mind :)