From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2002-06-28 02:52:52
David Abrahams wrote:
> From: "Joerg Walter" <jhr.walter_at_[hidden]>
> > > ) Why do all dynamic allocations via 'new' are followed by 'if (!data_)
> > > throw std::bad_alloc'? "new" already throws bad_alloc if memory is
> > exausted.
> > Not under MSVC.
> That's surely fixed for vc7 and even more-surely for 7.1 (though I'm not
> checking). If you absolutely /must/ do this you should go through a
> bottleneck function template for which specializations can be supplied in a
> compiled library, to cut down on code bloat in clients.
I didn't check for myself but KB-Article Q167733 (PRB: Operator New
Doesn't Throw bad_alloc Exception on Failure) applies to VC7 as well.
The C Run-Time (CRT), used with:
Microsoft Visual C++, 32-bit Enterprise Edition, versions 5.0 , 6.0
Microsoft Visual C++, 32-bit Professional Edition, versions 5.0 , 6.0
Microsoft Visual C++, 32-bit Learning Edition, version 6.0
Microsoft Visual C++ .NET (2002)
The usual workaround is to install a new handler which does the
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk