This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


1761. Runtime check on size of automatic array

Section: 9.3.4.5  [dcl.array]     Status: NAD     Submitter: USA     Date: 2013-09-23

N3690 comment US 10

The runtime check for violating the maximum size of a stack-based array object is ill-advised. Many implementations cannot easily determine the available stack space, and checking against a fixed limit is not helpful.

Proposed resolution (September, 2013):

Change 9.3.4.5 [dcl.array] paragraph 1 as follows:

...The expression is erroneous if:

...If the expression is erroneous, an exception of a type that would match a handler (14.4 [except.handle]) of type std::bad_array_length (_N3690_.18.6.2.2 [bad.array.length]) is thrown [Footnote: Implementations are encouraged also to throw such an exception if the size of the object would exceed the remaining stack space. —end footnote].

This resolution also resolves issue 1675.