Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > operator new no...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 9 Topic 9593 of 9831
Post > Topic >>

operator new not forced to throw std::bad_alloc?

by numerical.simulation@[EMAIL PROTECTED] May 13, 2008 at 11:57 AM

Hi!

During some debug session of an MFC application (VS2005) I found out
that std::allocator<double>::allocate calls operator new which throws
a
CMemoryException.

I expected operator new to throw std::bad_alloc, so that exception
went
uncaught. This is odd.

void* __cdecl operator new(size_t nSize)
{
....
  // That's platform specific code here:
  if (_afxNewHandler == NULL || (*_afxNewHandler)(nSize) == 0)
}


Q: Did I misunderstand Stroustrup?
Q: Is an STL allowed to throw things which do not inherit from
std::exception?
Q: No standard under my pillow: What's the wording about what operator
new may throw?


Markus

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 9 Posts in Topic:
operator new not forced to throw std::bad_alloc?
numerical.simulation@[EMA  2008-05-13 11:57:27 
Re: operator new not forced to throw std::bad_alloc?
Ronald Natalie <ron@[E  2008-05-13 21:07:26 
Re: operator new not forced to throw std::bad_alloc?
Alberto Ganesh Barbati &l  2008-05-13 21:07:52 
Re: operator new not forced to throw std::bad_alloc?
=?ISO-8859-1?Q?Daniel_Kr=  2008-05-13 21:06:59 
Re: operator new not forced to throw std::bad_alloc?
Ian Collins <ian-news@  2008-05-13 21:10:57 
Re: operator new not forced to throw std::bad_alloc?
Eberhard Schefold <ebe  2008-05-14 08:38:32 
Re: operator new not forced to throw std::bad_alloc?
Greg Herlihy <greghe@[  2008-05-14 11:41:05 
Re: operator new not forced to throw std::bad_alloc?
numerical.simulation@[EMA  2008-05-20 00:04:33 
Re: operator new not forced to throw std::bad_alloc?
numerical.simulation@[EMA  2008-05-20 00:27:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:51:43 CDT 2008.