Improving DIP74: functions borrow by default, retain only if needed
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Fri Feb 27 12:34:08 PST 2015
On 2/27/15 3:30 PM, Steven Schveighoffer wrote:
> void main()
> {
> C c = new C; // ref counted class
> C2 c2 = new C2; // another ref counted class
> c2.c = c;
> foo(c, c2);
> }
Bleh, that was dumb.
void main()
{
C2 c2 = new C2;
c2.c = new C;
foo(c2.c, c2);
}
Still same question. The issue here is how do you know that the
reference that you are sure is keeping the thing alive is not going to
release it through some back door.
-Steve
More information about the Digitalmars-d
mailing list