On Sun, May 24, 2009 at 5:11 PM, Andrew Venikov
<...>
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.
Precisely.
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?
No, I wouldn't want those to be ignored.
That's my point, you want some exceptions emitted by the throw expression to be ignored, and some not. Even if that was a good idea, you have to come up with an intuitive criteria which isn't going to surprise other users.
1.The system runs out of memory trying to allocate a certain resource. 2.An exception that indicates the condition and resource is thrown. 3.We try to add a description to the exception thrown, description requires memory. 4. But, since we're already out of memory, we fail creating the error description.
What exception would you rather want to receive in this case?
In my mind, the postcondition of throw foo() << info1(...) << info2(...) is that a foo exception containing info1 and info2 is thrown. If that postcondition can not be satisfied, I do want (another) exception that tells me why. Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode