> I see Ben's already answered in favour of exceptions, but I have to say > that (at least for the core library) I'm not in favour. (Though, like > the STL, I have no problem with using it in user-code, of course.)
The usual thing for C++ exceptions is that they're only for exceptional circumstances, which generally means your application is crashing. So constructors should throw when they can't make a valid object, asserts should throw when you violated a precondition, etc. It's a coding error, and the exception gives you a nice error message, traceback, and chance to shut down nicely and destructors to be called. So it's not really about trying to clean up mistakes after the fact. There's just not much a library can do if you passed an index out of bounds, but it's nicer to print a trace and quit rather than segfault. But then from that point of view, it's maybe not a big inconvenience to omit exceptions and use a "fatal error" callback that logs and quits. Most destructors don't need to be called if the program is quitting anyway. _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
