On Thu, Nov 13, 2008 at 11:45 PM, Ted Kremenek <[EMAIL PROTECTED]> wrote:

> Hi Zhongxing,
>
> This is a little heavy handed, but I'm actually going to revert this patch
> along with:
>
>
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20081110/009157.html
>
> 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.
>
> 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.
>
> Consider:
>
> char* p = alloca(BLOCK);
> new (p) Object1();
> ...
> new (p) Object2();
>
> Untyped memory can be recycled.  While this won't  occur that often, I
> think with the right design we can handle such things naturally.
>

I agree that another indirection is necessary, since:
 - We have no type information when creating AllocaRegion.
 - We have to attach type information to AllocaRegion.
 - Regions are immutable once created.

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.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to