Non-Initialized Dynamic Arrays Construction

simendsjo simendsjo at gmail.com
Mon Feb 24 04:11:58 PST 2014


On 02/24/2014 01:08 PM, "Nordlöw" wrote:
> On Monday, 24 February 2014 at 11:29:39 UTC, bearophile wrote:
>> TheFlyingFiddle:
>>
>>> http://dlang.org/phobos/std_array.html#.uninitializedArray is what
>>> you want.
>
> Wouldn't it be nice to have some kind of syntactic sugar for this
> similar to what we have for static arrays?
>
> BTW: Why isn't simply the following allowed?
>
>      int n = 3;
>      int[n] = void;
>
> Is it too easy to confuse with static array syntax?

Seems very dangerous. If n is available at compile-time it's a static 
array, else it's dynamic..?


More information about the Digitalmars-d-learn mailing list