On Sun, May 24, 2009 at 11:46 AM, Andrew Venikov
Consider this slightly modified example:
std::string get_descr();
.... throw f1exception() << f1_descr(get_descr());
Even if operator<< and f1_descr's constructor never throw, in theory you could still get std::bad_alloc instead of f1exception.
Exactly! That's what I meant in my original post.
What you want is, once you've reached a point in the program that is going to throw an exception, to guarantee that you will throw that exception and not something else. The problem is that this has to extend to all failures that can occur within the throw expression. Such failures are not limited to bad_alloc; any function you call in the throw expression may throw any exception. I'm reasonably certain that you don't want those to be ignored, do you? Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode