Title
Which exception to throw for overflow in array size calculation
Status
cd2
Section
7.6.2.8 [expr.new]
Submitter
UK

Created on 2009-03-03.00:00:00 last changed 179 months ago

Messages

Date: 2009-07-15.00:00:00

[Voted into WP at July, 2009 meeting as part of N2932.]

Date: 2009-03-15.00:00:00

Notes from the March, 2009 meeting:

The CWG was in favor of throwing an exception derived from std::bad_alloc. This would be upwardly compatible; it would be harmless for programs that currently catch std::bad_alloc, but would allow programs to treat the calculation overflow case separately if they wish.

Date: 2009-03-03.00:00:00
N2800 comment UK 72
N2800 comment UK 192

Throwing std::length_error (7.6.2.8 [expr.new] paragraph 7) for an attempt to allocate a too-large array brings in too much of the Standard library. A simpler exception, like std::bad_alloc, should be thrown instead.

History
Date User Action Args
2010-03-29 00:00:00adminsetstatus: wp -> cd2
2009-11-08 00:00:00adminsetstatus: dr -> wp
2009-08-03 00:00:00adminsetmessages: + msg2253
2009-08-03 00:00:00adminsetstatus: open -> dr
2009-03-23 00:00:00adminsetmessages: + msg1983
2009-03-03 00:00:00admincreate