Thread overview
[Issue 22331] spec is incorrect regarding interfacing C with GC and local variables
Sep 22, 2021
anonymous4
Dec 17, 2022
Iain Buclaw
September 22, 2021
https://issues.dlang.org/show_bug.cgi?id=22331

--- Comment #1 from anonymous4 <dfj1esp02@sneakemail.com> ---
Umm, the stack advice is solid, you just apparently conflate lifetime with lexical scope.

--
September 22, 2021
https://issues.dlang.org/show_bug.cgi?id=22331

--- Comment #2 from Steven Schveighoffer <schveiguy@gmail.com> ---
(In reply to anonymous4 from comment #1)
> Umm, the stack advice is solid, you just apparently conflate lifetime with lexical scope.

How would you leave a pointer on the stack?

This doesn't work:

------
void foo()
{
  auto c = new Class; // not on the stack
  c.method(); // c still not stored on the stack.
  GC.collect(); // possibly will collect c.
}
------

The recommendation in the spec is to use a "parameter or automatic variable". This doesn't work. If the recommendation is to store on the stack is solid, it should provide a solid mechanism to do so.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=22331

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 15
https://issues.dlang.org/show_bug.cgi?id=22331

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dlang.org/issues/4117

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--