So you could have it both ways: the finally block is done every time, and the restore code on a temp variable is done only when it's gone for good?
But, I think many C++ programmers think of using the former for the purpose of the latter. Especially any code that wants to undo/fixate things by playing with the caller's blocks (as mentioned in earlier discussions) it needs to be clear that setting up something triggered when a variable goes out of scope (e.g. restore from a temp) is not the same as code that's simply inserted just before the close brace of that scope. Earlier, your comments about doing without prompt destruction made me think that we would indeed be using the "finally"-like mechanism for that purpose.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|