06.07.2012 17:43, akaz пишет:
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.

If you are interested in D read this first:
http://dlang.org/garbage.html

You can find there e.g.:
> Do not add or subtract an offset to a pointer such that the result points outside of the bounds of the garbage collected object originally allocated.

So `p+=10;` is already "undefined behavior".

--
Денис В. Шеломовский
Denis V. Shelomovskij


Reply via email to