3 ms·
You can still use this trick in C++ if you ensure that the return statements are outside the scopes that have the RAII objects. It's awkward but it's better tha
by ufo 6y ago
You can still use this trick in C++ if you ensure that the return statements are outside the scopes that have the RAII objects. It's awkward but it's better than nothing. https://godbolt.org/z/cnbjaK85T https://godbolt.org/z/cnbjaK85T
void foo(int x) {
{
MyObj obj;
// ...
}
return bar(x); // tail call
}