Dynamic arrays allocation size

Steven Schveighoffer schveiguy at yahoo.com
Tue Mar 26 11:36:27 PDT 2013


On Tue, 26 Mar 2013 14:30:21 -0400, Johannes Pfau <nospam at example.com>  
wrote:

> Am Tue, 26 Mar 2013 14:04:25 -0400
> schrieb "Steven Schveighoffer" <schveiguy at yahoo.com>:
>
>>
>> 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.
>
> I think this is way more annoying though if the overflow happens in
> constant folding such as in the original example. In that case checking
> "only" adds overhead at compile time, so a warning would be nice.

Yes, I agree there.  The OP's code should either error out, or  
auto-promote to long.

But not in the general case.

-Steve


More information about the Digitalmars-d mailing list