Florian Weimer wrote:

This PR19351, by the way.

The most widespread interpretation of the standard is that conforming
implementations aren't allowed to raise an exception in this case:
the arithmetic is defined to occur in terms of an unsigned type.

Well for sure the standard does not allow you to generate junk
code silently, so given the two choices of bad code or an exception
I think the interpretation of the standard is not the relevent
criterion.

Anyway, you can always raise an exception if you run out of storage,
and the standard has nothing formal to say on that topic.

The official response from the C++ folks is here:

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#256

| Each implementation is required to document the maximum size of an
| object (Annex B limits). It is not difficult for a program to check
| array allocations to ensure that they are smaller than this
| quantity. Implementations can provide a mechanism in which users
| concerned with this problem can request extra checking before array
| allocations, just as some implementations provide checking for array
| index and pointer validity. However, it would not be appropriate to
| require this overhead for every array allocation in every program.

You are quoting rationale. Surely that has no normative force. A
standard cannot meaningfully talk about what is or what is not
appropriate code generation anyway.

Reply via email to