Unexpected memory reuse
bearophile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jul 31 12:41:12 PDT 2014
Marc Schütz:
>> class buffer(T, size_t sz) {
>> auto arr = new T[sz];
>
> This allocates an array with `sz` elements once _at compile
> time_, places it somewhere into the executable, and uses its
> address as the default initializer for the member `arr`.
Right. It's not a compiler bug. Dmd/ldc are working correctly.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list