<br><br><div class="gmail_quote">On Thu, Nov 13, 2008 at 11:45 PM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Zhongxing,<br>
<br>
This is a little heavy handed, but I'm actually going to revert this patch along with:<br>
<br>
<a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20081110/009157.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20081110/009157.html</a><br>
<br>
There is a reason why MemRegion* have a const qualifier; they never can be changed in any way.  The const_cast itself is an indicator to me that this is the wrong design.  It violates the functional programming design of how we track state, and modifying the MemRegion object in this way can introduce subtle bugs.<br>

<br>
We'll need to iterate on this one.  We may end up applying your patch back, so please don't take my reverting it personally.<br>
<br>
Consider:<br>
<br>
char* p = alloca(BLOCK);<br>
new (p) Object1();<br>
...<br>
new (p) Object2();<br>
<br>
Untyped memory can be recycled.  While this won't  occur that often, I think with the right design we can handle such things naturally.<br><font color="#888888">
</font></blockquote><div><br>I agree that another indirection is necessary, since:<br> - We have no type information when creating AllocaRegion.<br> - We have to attach type information to AllocaRegion.<br> - Regions are immutable once created. <br>
</div></div><br>The question remains is that when shall we create this indirect layer. A plausible time is when we have the type information, we create the indirect layer.<br>