Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 31,770 of 33,346    |
|    Wil Evers to Daryle Walker    |
|    Re: Just making sure about an assumption    |
|    30 Dec 11 16:07:26    |
      2a43a256       From: bouncer@dev.null              Daryle Walker wrote:              > If an exception happens while the return value is transferred from       > my_function to whatever called it, does my_function have to worry about       > its noexcept specification being violated? Or has my_function already       > ended, and any exception emitted gets compared against the noexcept       > setting of the caller function? As I said, I hope it's the latter,       > because the transfer happens at a point where the called function can't       > use try-catch or any other way of keeping the exception from leaking.              At the point where a function's return value is constructed, its local       context is still very much alive. Local variables and temporaries can       only be destroyed later - otherwise we would not be able to access them       from the function's return expression. To me, this suggests that an       exception escaping from the function's return expression, or from any       of the destructors triggered when returning from the function, would       violate a promise to not throw.              I can't think of any technical reason why a return expression could not       be wrapped in a try-block; logically, however, I wouldn't know what to       do in the corresponding catch-block to remedy the situation. A function       should return a meaningful value; a promise to not throw implies it is       either able to do so or not return at all - which is exactly what       noexcept brings us.              - Wil                     --        [ See http://www.gotw.ca/resources/clcm.htm for info about ]        [ comp.lang.c++.moderated. First time posters: Do this! ]              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca