edit: bottom line up, without a proxy object, objects are referenced directly through regular pointers. / Change
structs , , , . :
struct S {
S* lol;
void beBad() {
lol = &this;
}
}
S pain() {
S s;
s.beBad();
return s;
}
void main() {
S s;
s = pain();
assert(s.lol !is &s);
}
(EDIT: , , postblit , . , , , , , . EDIT2: , / - , postblit. , , - , . . . /edit )
, , pain , main, ( , , , , , - : " ", / ).
, , , , , ; , undefined.
. this , ( )) - . (, GC ( D )), , , , .
, - , , ( GC...)
, , , . - , -.
source
share