Dynamic arrays allocation size
Steven Schveighoffer
schveiguy at yahoo.com
Tue Mar 26 11:35:30 PDT 2013
>> (And Issue 4835 is about compile-time constants. CFFE is already plenty
>> slow, mostly because of memory allocations. Detecting overflow in
>> constants is not going to significantly slow down compilation, and it
>> has no effect on the runtime. Even GCC 4.3.4 performs such compile-time
>> tests.)
>
> If CTFE did something different than real code, that would be a
> problem. Again, you should be able to construct the needed types with a
> struct, to use in both CTFE and real code.
Let me clarify that constants that are combined by default (even without
optimizations enabled), like the OP's example of 1024 * 1024 * 1024,
should be able to emit an error at compile time on overflow, or
automatically upgrade the type, I agree with that.
-Steve
More information about the Digitalmars-d
mailing list