@safe leak fix?
Brad Roberts
braddr at bellevue.puremagic.com
Wed Nov 11 14:42:48 PST 2009
On Wed, 11 Nov 2009, Walter Bright wrote:
> So it occurred to me that the same solution for closures can be used here. If
> the address is taken of a stack variable in a safe function, that variable is
> instead allocated on the heap. If a more advanced compiler could prove that
> the address does not escape, it could be put back on the stack.
>
> The code will be a little slower, but it will be memory safe. This change
> wouldn't be done in trusted or unsafe functions.
I think safe vs unsafe causing a behavior change is a really bad idea.
They're contracts / constraints, not modifiers.
- Brad
More information about the Digitalmars-d
mailing list