<br><br>
<div class="gmail_quote">2010/10/23 Marcin Świderski <span dir="ltr"><<a href="mailto:marcin.sfider@gmail.com">marcin.sfider@gmail.com</a>></span><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div class="gmail_quote">W dniu 22 października 2010 11:22 użytkownik Zhongxing Xu <span dir="ltr"><<a href="mailto:xuzhongxing@gmail.com" target="_blank">xuzhongxing@gmail.com</a>></span> napisał: 
<div class="im"><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">When the binary operator is logical operator, why we need to replicate the control flow when adding the dtors in LHS and RHS? Could we just add the dtor right after where the LHS and RHS are evaluated?<br>
<br>That is, for code<br><br>A && B<br><br>we generate CFG like this:<br><br>A && B<br>~A()<br>|      \<br>|       B<br>|       ~B()<br>|        |<br>A && B<br><br>Since in logical binary operator, we only need the boolean value. The temporary object can be destroyed right after it is evaluated.<br>
<br></blockquote></div>
<div>This depends on how much we want to simulate real control flow of expression. C++ standard states that destructors of temporaries should be called at the end of full expression and in reverse order of their construction. Your example does not satisfy this. It only guaranties that destructor for temporary will be called.</div>
</div></blockquote>
<div> </div>
<div>I know it does not conform to the standard. I just proposed it to see if it is a viable alternative for CFG construction. But extending the CFG terminator could be a good idea. I'll think about it.</div></div>