根据 MSDN :



以我的理解,就是说:“这么常见的代码片段是危险的!”

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
    {}
}

在 C++ 项目中完全避免 __leave 是最佳实践吗?

最佳答案

http://msdn.microsoft.com/en-us/library/yb3kz605.aspx

说:



编辑:
此外,避免使用特定于编译器的功能通常是好的。

关于c++ - 为什么VC++要引入非标准关键字: __leave?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18819205/

10-11 21:57
查看更多