Replacing new? (was re: -nogc)

Kagamin spam at here.lot
Fri Apr 24 02:20:00 PDT 2009


Andrei Alexandrescu Wrote:

> 1. Create one heap object of type T with creation arguments args. 
> Currently: new T(args), except when T is a variable-sized array in which 
> case syntax is new T[arg] (only one arg allowed). It is next to 
> impossible to create one heap object of fixed-size array type.

You can create it. new T[arg] does just that. You can't *use* it.
T[5]* arr=something;
arr[3]; //wrong
(*arr)[3]; //ok

And as it was said, current new syntax allows arguments for array new.



More information about the Digitalmars-d mailing list