This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Is delete (nothrow) supported?
- From: "H. J. Lu" <hjl at lucon dot org>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 9 Jan 2007 14:27:11 -0800
- Subject: Re: Is delete (nothrow) supported?
- References: <20070109215544.GA505@lucon.org>
On Tue, Jan 09, 2007 at 01:55:44PM -0800, H. J. Lu wrote:
> Does gcc support "delete (nothrow)"? I ran into 2 problems:
>
> 1. I had to call destructor directly since
>
> A *p = new (std::nothrow) A;
> delete (std::nothrow) p;
>
> won't cpmpile. I had to use
>
> A *p = new (std::nothrow) A;
> ...
> operator delete (bb, std::nothrow);
>
> 2.
>
> A *bb = new (std::nothrow) A [10];
> ...
> operator delete [] (bb, std::nothrow);
>
> causes memory corruption since compiler doesn't support
>
> delete (std::nothrow) [] p;
>
> What is the proper way to use "delete (nothrow)"?
I figured out that "delete (nothrow)" is mainly for compiler uses.
H.J.