Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2005-12-28 07:03:07

Daniel Frey wrote:

> I think operator new is intended to be called by new T. As zero sized
> types don't exist, operator new will never be called with n==0.
> But there's nothing which prevents you from calling operator new
> directly, so maybe it's even possible for operator new.
> What do the experts say? Was this intended or is it a defect report? Or
> am I missing something?
> (Note: I'm not talking about operator new[], which can be asked to
> allocate an array of zero objects as per 5.3.4/7)

Hmm, what you're saying sounds reasonable, but nevertheless I was observing
an exception due to a zero sized request somehow generated by the standard
library implemenation on my platform. defines the effects of operator new() as follows: 'The allocation
function ( called by a new-expression (5.3.4) to allocate size
bytes of storage suitably aligned to represent any object of that size.'

An allocation function must comply to the behaviour required in,
therefore I would think that operator new() has to comply to this behaviour
as well. And nothing forbids others callers (besides the new-expression) of
operator new(), AFAICT.


Boost list run by bdawes at, gregod at, cpdaniel at, john at