deprecated delete and manual memory management

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Apr 26 10:56:33 PDT 2011


On 4/26/11 12:36 PM, Benjamin Thaut wrote:
> I've been reading through various delete topics in the past hour, but
> couldn't find any statement on how manual memory management would look,
> if the delete operator is deprecated. Something like the following seems
> really odd:
>
> class foo {
> public new(size_t sz){ //language support
> return malloc(sz);
> }
>
> public void Delete(){ // no language support ??
> this.__dtor();
> free(this);
> }
> }
>
> auto fooInst = new foo(); //language support
> fooInst.Delete(); //no language support ??

You'd just define functions for object creation and disposal.

Andrei


More information about the Digitalmars-d mailing list