vestigial delete in language spec
Dan
dbdavidson at yahoo.com
Thu Nov 1 14:21:11 PDT 2012
TDPL states
------
However, unlike in C++, clear does not dispose of the object’s
own memory and there is no delete operator. (D used to have a
delete operator, but it was deprecated.) You still can free
memory manually if you really, really know what you’re doing by
calling the function GC.free() found in the module core.memory.
------
The language spec has this example from the section on Struct
Postblits:
------
struct S {
int[] a; // array is privately owned by this instance
this(this) {
a = a.dup;
}
~this() {
delete a;
}
}
------
Is the delete call, then per TDPL not necessary? Is it harmful or
harmless?
Also, are there any guidelines for using and interpreting the
output of
valgrind on a D executable?
Thanks
Dan
More information about the Digitalmars-d-learn
mailing list