implicit use of placement new but not of placement delete
Wed Jun 30 23:15:00 GMT 1999
> Actually, I'd better read the standard over one more time before I
> approve this patch. I'll let you know tomorrow, unless Jason beats me
> to it.
FYI, in case you've not seen this Alexander Schiemann submitted the attached
defect report to comp.std.c++ about this issue.
FWIW I can't tell what the standard wants here, but Alexander S's proposal
takes the principle of least surprise. If the standard does require us to call
the non-placement delete it'd be a good idea to warn somewhere :-)
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
I have seen the death of PhotoShop -- it is called GIMP
email@example.com http://www.cs.bris.ac.uk/~nathan/ firstname.lastname@example.org
Subject : Defect Report: ambiguity 'matching deallocation function'
>From : Alexander Schiemann <aschiem at math dot uni-sb dot de>
Date : 08 Jun 99 14:35:46 GMT
Approved : Valentin Bonnard <email@example.com>
Newsgroups : comp.std.c++
Organization : Universitaet des Saarlandes FB Mathematik
Xref : bris.ac.uk comp.std.c++:37201
This is about 5.3.4 [expr.new] paragraph 17-19 (p.80)
If an exception occurs during object initialization in a new-
expression then a 'matching deallocation function' (if unambiguous)
is called. Paragraph 19 defines the matching deallocation function
for placement allocation functions and non-placement ones.
I did not find a definition of 'placement allocation function' that
solves the following ambiguity:
If one declares an allocation function with a 2nd parameter but
supplies a default argument then this function may be called from a
new-expression without placement argument. If we look for a matching
deallocation function should we look for one with a placement argument
or not? I.e. does the term 'placement allocation function' depend
1. on the declaration of the function (disregarding default arguments
used in the call)
2. or on the syntax of the new-expression that calls the allocation
My favorite answer is 1) but the egcs compiler (versions 1.0.3--1.1.2)
Alexander Schiemann firstname.lastname@example.org
>>>>>>>>>>> begin example
void* operator new(size_t size, double x=3.5)
return ::operator new(size);}
void operator delete(void* p, double)
<<" matching operator delete with placement argument\n"
<<" although no explicit placement argument in the\n"
void A::operator delete(void* p)
<<" matching non-placement operator delete\n"
<<" for operator new called with default placement argument"
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:email@example.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
More information about the Gcc-patches