N
Noah Roberts
I am having some problems with deriving the std::exception class. My
compiler (g++-2.95) works with it just fine, but it does in a lot of
broken cases. I have a user/developer that can't compile the following
code:
class CFENException : public std::exception
{
std::string _what;
public:
CFENException(std::string what) : _what(what) {}
virtual const char* what() const throw() { return _what.c_str(); }
};
He is getting the following error from dev-c++ 4.9.8.1:
line 57 in BitBoard.h: looser throw specifier for 'virtual
line 54 in exception: overriding 'virtual
Isn't throw() the tightest specifier you can get? It says this method
cannot throw anything right?
My book on the c++ std, The C++ Standard Library by Josuttis, says the
above is the correct way to derive the exception class. So WTF am I
doing wrong if anything?
Thanks for any help,
NR
compiler (g++-2.95) works with it just fine, but it does in a lot of
broken cases. I have a user/developer that can't compile the following
code:
class CFENException : public std::exception
{
std::string _what;
public:
CFENException(std::string what) : _what(what) {}
virtual const char* what() const throw() { return _what.c_str(); }
};
He is getting the following error from dev-c++ 4.9.8.1:
line 57 in BitBoard.h: looser throw specifier for 'virtual
line 54 in exception: overriding 'virtual
Isn't throw() the tightest specifier you can get? It says this method
cannot throw anything right?
My book on the c++ std, The C++ Standard Library by Josuttis, says the
above is the correct way to derive the exception class. So WTF am I
doing wrong if anything?
Thanks for any help,
NR