exception handling

This is a discussion on exception handling within the C++ Programming forums, part of the General Programming Boards category; just one of my functions isn't throwing exceptions for some reason. this one doesn't work:
Code:
void list::insert(const plane& p) ...

In exceptions it is sometimes wise to use static arrays over std::string because if std::string attempts to allocate memory and fails, then it will throw its own exception, and if that happens during the processing of your exception it means the entire program aborts with no cleanup or destructor calls or anything. That's why people often use character arrays for exceptions and just document that the message must be less than a certain size.

In exceptions it is sometimes wise to use static arrays over std::string because if std::string attempts to allocate memory and fails, then it will throw its own exception, and if that happens during the processing of your exception it means the entire program aborts with no cleanup or destructor calls or anything. That's why people often use character arrays for exceptions and just document that the message must be less than a certain size.

Couldn't you get the same behavior by using reserve() with the std::string to set the capacity to the desired value beforehand?

In exceptions it is sometimes wise to use static arrays over std::string because if std::string attempts to allocate memory and fails, then it will throw its own exception, and if that happens during the processing of your exception it means the entire program aborts with no cleanup or destructor calls or anything. That's why people often use character arrays for exceptions and just document that the message must be less than a certain size.

Of course, you can still allow a std::string to be used in the constructor, you just have to convert to a C string in order to store it: