--- Comment #2 from bearophile_h...@eml.cc 2010-02-18 12:32:38 PST ---
(In reply to comment #1)
> I've never used alloca so I'm not sure, so this is a guess:
> alloca does stack allocation and the body of the for statement forms a scope
> the stack (this in this case contains no named variables). I'm guessing that
> when that scope is exited, the allocation automatically gets deallocated.
You can be right, thank you. Then it's very good for Phobos docs to say that
alloca is relative to a scope and not to a function.
The description of alloca() that I have seen says:
The alloca() function allocates space in the stack frame of the caller, and
returns a pointer to the allocated block. This temporary space is automatically
freed when the function from which alloca() is called returns.
While if you are right D alloca frees space when the scope of alloca ends and
not when the function ends.
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------