Dynamic arrays allocation size
Steven Schveighoffer
schveiguy at yahoo.com
Tue Mar 26 11:04:25 PDT 2013
On Tue, 26 Mar 2013 13:56:35 -0400, Luís Marques <luismarques at gmail.com>
wrote:
> BTW, as far as I can see the overflow/underflow behavior never got
> specified by the language, in any case:
>
> 1) http://forum.dlang.org/thread/jo2c0a$31hh$1@digitalmars.com <-- no
> conclusion
>
> 2) Andrei's book doesn't seem to mention the topic.
>
> If it is specified somewhere please do tell. Whatever the behavior
> should be (unspecified, modulus for unsigned integers, etc) there really
> should be an official stance.
The official stance is, it's not an error. If we treated it as an error,
then it would be very costly to implement, every operation would have to
check for overflow. The CPU does not assist in this.
You can construct an "overflow-detecting" integer type that should be able
to do what you want.
-Steve
More information about the Digitalmars-d
mailing list