C++ Logo

std-proposals

Advanced search

Re: [std-proposals] promote T[] and deprecate delete[]

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Tue, 1 Jul 2025 23:23:12 +0100
On Tue, 1 Jul 2025, 22:46 Matthew Taylor via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> I certainly appreciate that the delete/delete[] mix is a rough edge in the
> language, but I'm going to echo sentiment elsewhere in the thread that this
> is a far more breaking change than you initially suggested. Equally, I'm
> not sure that allowing decay from T[] to T* is necessarily a good idea
> towards solving the problem. It's easy to imagine some code which
> accidentally performs that decay, passes a decayed array-type pointer to
> regular delete, and then we're back to square one except the mistake is
> much more implicit because passing arrays to the "normal" delete operator
> is now the expected thing to do.
>
> If we could go back in time and design C++98 differently then perhaps we'd
> want to do something along this line.
>

Yes, it's 35 years too late to make this change.

Received on 2025-07-01 22:23:29