Garbage Collection Pitfall in C++ but not in D?

akaz nemo at utopia.com
Fri Jul 6 06:43:37 PDT 2012


Hi,

  Reading about the C++11, I stumbled upon this:

  http://www2.research.att.com/~bs/C++0xFAQ.html#gc-abi

  Specifically (quote):

  	int* p = new int;
	p+=10;
	// ... collector may run here ...
	p-=10;
	*p = 10;	// can we be sure that the int is still there?

  How does the D garbage collector solves (answers) that?

Thank you.


More information about the Digitalmars-d-learn mailing list