www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: A feature request

reply Yonggang Luo <yonggangluo hotmail.com> writes:
bearophile Wrote:

 ÂÞÓÂ¸Õ Wrote:
 I recommend that in D2 add a new keyword gcnew for garbage collection heap
allocation.    the default new and delete key word just for someone that want
management the memory by themselves.
 I think we just using new for garbage collection memory allocation and for
someone that using new for memory management by themeselvs will misleading!

In D the "default" is generally the safer way (that here is the GC way), this allows the programmer to put less bugs in the code. Bye, bearophile

Jul 07 2008
next sibling parent Robert Fraser <fraserofthenight gmail.com> writes:
Yonggang Luo wrote:
 bearophile Wrote:
 
 ÂÞÓÂ¸Õ Wrote:
 I recommend that in D2 add a new keyword gcnew for garbage collection heap
allocation.    the default new and delete key word just for someone that want
management the memory by themselves.
 I think we just using new for garbage collection memory allocation and for
someone that using new for memory management by themeselvs will misleading!

Bye, bearophile


No. It will work fine.
Jul 07 2008
prev sibling parent bearophile <bearophileHUGS lycos.com> writes:
Yonggang Luo:
 Yes, gc is more safe, but also there is a keyword delete, is there any conflic
here? I don't know if there conflict here. If I alloca memory space by gc, and
delete it by hand, is there any conflict will happen?

In a reference counting GC the detele isn't a way to delete memory by hand, it tells the GC to remove a (hard) refence to some memory. Later the GC can really remove the memory only if there aren't references to it left (this is in a reference counting GC, but in other GCs the final results are similar). Bye, bearophile
Jul 07 2008