Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On Exception-Safety in a Function-Call

Is the call to f() exception-safe?

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 it make any difference when it comes to the atomicity of the first and second auto_new() function calls if the two functions are inline?

like image 579
wilhelmtell Avatar asked Jan 27 '26 03:01

wilhelmtell


1 Answers

Yes, it's exception safe; no, inline makes no difference to the sequence points guaranteed in the calling expression.

like image 110
CB Bailey Avatar answered Jan 29 '26 19:01

CB Bailey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!