About exceptional security in a functional call

Is the call f()safe for exceptions?

inline std::auto_ptr<C> auto_new() {
   return std::auto_ptr<C>(new C());
}

void f(std::auto_ptr<C> p1,
       std::auto_ptr<C> p2);

// ...
{
    f(auto_new(), auto_new());
}

In other words, does any value matter when it comes to the atomicity of the first and second functions of a function auto_new()if the two functions are built-in?

+3
source share
1 answer

Yes, this is a safe exception; no, inlinehas nothing to do with sequence points guaranteed in the calling expression.

+5
source

Source: https://habr.com/ru/post/1786339/


All Articles