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.