Mail Archives: djgpp/1998/05/30/07:47:23
Since C++ is a strongly typed language, unlike C, the compiler
considers
const char *
and
char *
different types, though there is an obvious relationship to humans.
Therefore, if you throw one type, a handler of the other type
cannot catch it. I believe djgpp considers the type of the string
"unable to catch" to be char *, which explains the problem.
If you want to use a const char* handler, you might have to cast the
string to a const before throwing it.
An alternate route is not to throw the string directly at all. Create a simple
class with only a public pointer to the error string and throw that. Or, make
it more robust.
Hope this helped.
--
Evan
EPTheCoder AT aol DOT com http://members.aol.com/EPTheCoder/
EPTheCoder AT bigfoot DOT com http://bounce.to/EPTheCoder/
- Raw text -