Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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

    void foo(int x) {
      {
        MyObj obj; 
        // ...
      }
      return bar(x); // tail call
    }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: