[Development] QtCore missing check for memory allocation

Al-Khanji Louai louai.al-khanji at theqtcompany.com
Fri Feb 27 14:57:56 CET 2015


Sure, here's what I know:

Regarding operator new:

http://en.cppreference.com/w/cpp/memory/new/operator_new

C++11 cleans up the exception specifications and specifies that the no-throw single object variant is called by the standard implementations of all other versions.

Regarding operator delete:

http://en.cppreference.com/w/cpp/memory/new/operator_delete

C++11 again cleans up the exception specifications and specifies like with operator new that the single object variant is called by the standard implementations of all other variants.
C++14 introduces sized global delete which can be very useful for custom allocators (for a classic example see the small object allocator in Alexandrescu's Modern C++ Design, source code for his library: http://sourceforge.net/p/loki-lib/code/HEAD/tree/trunk/).


That the various implementations all internally by default call the single object versions of new/delete has long been the canonical thing to do, but it wasn't actually specified by the standard. The noexcept cleanups are straight-forward but necessary. The really interesting bit to me is the addition of global sized operator delete in C++14.


--Louai


> -----Original Message-----
> From: Gunnar Roth [mailto:gunnar.roth at gmx.de]
> Sent: Friday, February 27, 2015 2:11 PM
> To: Al-Khanji Louai
> Cc: development at qt-project.org
> Subject: Aw: Re: [Development] QtCore missing check for memory allocation
> 
> Hi,
> 
> >  in fact both C++11 and C++14 have improved the ways in which the
> new/delete operators can be overridden.
> 
> can you give me some links describing these improvements?
> 
> regards,
> Gunnar Roth
> 


More information about the Development mailing list