In article <vp************@news.supernews.com>,
"Dave" <be***********@yahoo.com> wrote:
"Dave" <be***********@yahoo.com> wrote in message
news:vp***********@news.supernews.com... Is it possible for the nothrow form of the new operator to ever throw?
Oh Lord, what on Earth is wrong with me...
Is it possible for *PLACEMENT* new to ever throw???
Somebody shoot me!!!
<chuckle> Actually your original question has interesting answers. Just
goes to show: there are no dumb questions! :-)
Yes, the nothrow form of the new operator can throw. Well, that's
probably a bit too inflamatory. A new-nothrow expression can throw.
Consider:
struct X
{
X() {throw "up";}
};
void foo()
{
X* xp = new (std::nothrow) X;
}
The new expression in foo() will throw, even though it is using the
nothrow expression. Same deal for placement new.
-Howard