Title
Determining the buffer size for placement new
Status
extension
Section
8.3.4 [expr.new]
Submitter
Ben Hutchings

Created on 2004-09-14.00:00:00, last changed 2012-02-27.00:00:00.

Messages

Date: 2012-02-15.00:00:00

Rationale (February, 2012):

The CWG agreed that EWG is the appropriate venue for dealing with this issue.

Date: 2012-01-17.00:00:00

Note, January, 2012:

It has been suggested that this issue is more appropriate for EWG and should thus be closed with "extension" status.

Date: 2005-04-15.00:00:00

Notes from the April, 2005 meeting:

While the CWG agreed that there is no portable means to accomplish this task in the current language, they felt that a paper is needed to analyze the numerous mechanisms that might address the problem and advance a specific proposal. There is no volunteer to write such a paper at this time.

Date: 2007-09-09.00:00:00

(See also issue 256.)

An implementation may have an unspecified amount of array allocation overhead (8.3.4 [expr.new] paragraph 10), so that evaluation of a new-expression in which the new-type-id is T[n] involves a request for more than n * sizeof(T) bytes of storage through the relevant operator new[] function.

The placement operator new[] function does not and cannot check whether the requested size is less than or equal to the size of the provided region of memory (21.6.2.3 [new.delete.placement] paragraphs 5-6). A program using placement array new must calculate what the requested size will be in advance.

Therefore any program using placement array new must take into account the implementation's array allocation overhead, which cannot be obtained or calculated by any portable means.

History
Date User Action Args
2012-02-27 00:00:00adminsetmessages: + msg3862
2012-02-27 00:00:00adminsetstatus: open -> extension
2012-01-17 00:00:00adminsetmessages: + msg3622
2005-05-01 00:00:00adminsetmessages: + msg1173
2004-09-14 00:00:00admincreate