
On 11/02/2004, at 4:48 AM, Victor A. Wagner, Jr. wrote:
At Tuesday 2004-02-10 00:01, you wrote:
Funny that gcc's runtime_error uses a string copy constructor that could potentially throw :-)
what exception do you see it throwing (possibly) ?
Well, I thought it might throw a bad_alloc and, as Jonathan said :
Have you seen
http://www.boost.org/more/error_handling.html
particularly item 4 ("Format the what() message o demand"), but also 3 and 5?
See item 3. However, Jonathan also cleared up the bad_alloc:
...I haven't studied the libstdc++ string class in detail, but I think it's a reference counted string whose copy constructor shouldn't throw in the circumstances we've discussed. Other libraries (Dinkumware, I think) definitely have this problem.
I haven't looked past the stdexcept header in gcc, but at a brief glance it seems to me that MSL's runtime_exception could throw a bad_alloc. cheers, Geoff