Top 5

Benji Smith dlanguage at benjismith.net
Fri Oct 10 09:23:56 PDT 2008


Steven Schveighoffer wrote:
> "Benji Smith" wrote
>> I think *all* arrays should be declared like this:
>>
>>    T[] array = new T[n];
>>
>> If "n" is known it compile time, then D can use CTFE to create a static 
>> array, and if "n" isn't known until runtime, it can create a dynamic 
>> array. But as the user, I don't want to care which is which.
> 
> What if n is 10000?  It's small enough that it could be stack allocated, but 
> large enough that you might not want it to do that.

Sounds like a perfect decision for the compiler (or the runtime) to make.

D eliminated the "register" and "inline" keywords for exactly the same 
reason.

--benji



More information about the Digitalmars-d mailing list