[LLVMdev] Memory Allocation Optimized away with new by not with ::operator new

David Blaikie dblaikie at gmail.com
Mon May 4 08:47:37 PDT 2015


On Mon, May 4, 2015 at 6:27 AM, François Fayard <fayard.francois at icloud.com>
wrote:

> Hi,
>
>
> I have checked and N3664 only talks about new/delete but not about operator
> new/delete. Do you know the rationale behind this choice?
>

I believe the notion was to provide a syntax for /actually/ calling those
functions that the compiler couldn't optimize away, in case you wanted them
for their side effects, etc.


>
> On 04 May 2015, at 13:45, Benjamin Kramer <benny.kra at gmail.com> wrote:
>
>
> Sadly this is a feature. The C++ standard has been unclear
>
> historically about whether removing pairs of new/delete. The problem
>
> is that the user may override them so this is an observable change,
>
> but some compilers (LLVM) removed them anyways. As you said C++14
>
> changed the wording so removing new/delete expression pairs is now
>
> explicitly legal. Calls to ::operator new and delete aren't new/delete
>
> expressions though, so it should behave as expected when overridden.
>
>
> It looks like a glitch in the standard, but if I remember correctly it
>
> was done intentionally.
>
>
> - Ben
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150504/d9565f4e/attachment.html>


More information about the llvm-dev mailing list