When this will be freed?

Jacob Carlborg doob at me.com
Sat Apr 5 04:28:35 PDT 2014


On 2014-04-04 15:25, "Marc Schütz" <schuetzm at gmx.net>" wrote:

> This is unfortunately only true on x86 32-bit. For x86_64, the calling
> conventions (MS, SysV [1]) say that the first few parameters are passed
> in registers, and the same is probably true for other architectures.

I'm not so familiar with calling conventions and how the stack and 
registers work. But take this as an example:

extern (C) void foo (in char*);

void bar ()
{
     string s = "asd";
     foo(s.ptr);
}

Even if "s" is passed in a register to "foo", won't the stack of "bar" 
still be available until "foo" returns?

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list