Why does VC++ introduce such an evil nonstandard keyword: __leave?
According to MSDN:
The __leave statement is more efficient because it does not cause stack
unwinding.
To my understanding, that is to say: "Such a common code snippet is
dangerous!"
struct A
{
int* p;
A() : p(new int) {}
~A() { delete p; }
};
void f()
{
__try
{
A a;
... // Doing somthing
if (the thing has gone bad) __leave;
... // Continue
}
__finally
{}
}
Is it a best practice to totally avoid __leave in C++ projects?
No comments:
Post a Comment