News for hackers. Stuff that matters.
Re:Modern C [pdf] by int_19h on Monday November 28, 2016 @05:00PM (#13058798)
If I remember correctly, C++ flat out bans all uses of goto that could affect constructors and destructors. For example, something like this won't compile:

    int main() {
        goto g;
        std::string s;
        g: return 0;
    }
while this will compile, but destructor is guaranteed to be called:

    int main() {
        {
            std::string s;
            goto g;
            return 1;
        }
        g: return 0;
    }
Now, longjmp is another matter. That thing is basically verboten in any sane C++ environment (and consequently, C libraries that use it across API boundary are very painful to use from C++; R hosting API is a great example of that).

There are no comments on this comment yet.