typeof([2,2]) !=? int[2]

Zhenya zheny at list.ru
Fri Mar 8 15:08:00 PST 2013


On Friday, 8 March 2013 at 23:03:47 UTC, Zhenya wrote:
> On Friday, 8 March 2013 at 22:59:40 UTC, bearophile wrote:
>> This is an answer to just your title question.
>>
>> A lot of time ago typeof([2,2]) was int[2]. This was 
>> efficient, but in most cases this was a source of troubles and 
>> bugs. So now a [2,2] is a heap-allocated dynamic array of type 
>> int[]. Some persons have askes for a fixed-sized array litera, 
>> like s[2,2] but nothing has happened on this so far.
>>
>> Bye,
>> bearophile
>
> Thank you very much.

Although it's a bit strange,since we can always pass heap 
allocated array by
using new.


More information about the Digitalmars-d-learn mailing list