Boost logo

Boost :

Subject: Re: [boost] boost.lockfree update
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-07-23 16:49:32


AMDG

Christian Holmquist wrote:
> The following doesn't look correct to me: If pool.allocate() is not supposed
> to throw an exception, you're constructing a node on a null pointer.
>
> node * alloc_node(void)
> {
> node * chunk = pool.allocate();
> new(chunk) node(); <---------- chunk may be 0?
> return chunk;
> }
>

It's okay if chunk is zero. Placement new is declared with throw(),
so according to (5.3.4/13) it indicates failure by returning a null pointer,
and the constructor will not be called.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk