On 2011-04-28 00:15, Alexander wrote:
On 27.04.2011 22:42, Steven Schveighoffer wrote:
For non-garbage-collected languages, yes. For GC languages, delete is to be
discouraged (that is what the GC is for).
delete() is 99% of the cases O(1) operation (thanks to free lists), while
invocation of GC is O(?) (no one knows how many objects are pending
deallocation, and when exactly it will be invoked).
I agree that in normal applications (mostly) this is rarely an issue, but there
are not normal applications, which I mentioned previously - RT& OS, and some
others.
If you're writing an OS you would need to write your own runtime anyway.
Additionally, memory management hooks supported by the compiler are faster than
any other solution (templates& co).
Java and C# code do not have much use for delete either
What about those coming from C++ and D1 (including D2 up to this point)?
But, actually, I am really interested in only one thing... I agree, that
some may feel discomfort using delete, but what is the reason to remove it from
the language? Probably, I've missed something, but why not to leave it as is
for those who need it?
/Alexander
--
/Jacob Carlborg