What can you "new"
bearophile
bearophileHUGS at lycos.com
Sun Mar 22 11:38:39 PDT 2009
Steve Teale:
> What am I missing here, isn't char[] a dynamic array?
I suggest you to post such questions to the "learn" newsgroup.
D dynamic arrays aren't objects, they are C-like structs that contain a just length and a pointer (no capacity). The "new" for them is needed only to allocate the memory they point to. So to define an empty dynamic array of chars:
char[] ca;
In D1 you can also just:
string s1;
To allocate a non empty array of chars of specified len:
auto ca = new char[some_len];
Tale a look at the D docs, where such things are explained.
Bye,
bearophile
More information about the Digitalmars-d
mailing list