On 2/5/13 2:11 PM, H. S. Teoh wrote:
On Tue, Feb 05, 2013 at 02:05:24PM -0500, Steven Schveighoffer wrote:
On Tue, 05 Feb 2013 13:33:35 -0500, Andrei Alexandrescu
<[email protected]>  wrote:

Walter and I reviewed the discussion and had a long talk. We are
very seriously considering banning the use of&  against a ref
result from a function (and actually ref parameters and even
struct members in @safe code). One would still be able to take the
address of a field in a class because that's assumed to live on
the GC heap.

What about structs that live on the heap?  e.g. a struct element of
an array, or a struct member of a class instance.

I think the point about @safe code is moot, aren't pointers
disallowed in safe code anyway?
[...]

AFAIK, pointers are allowed in @safe code as long as no type casts or
pointer arithmetic are performed.

Yah, apparently that's not sufficient. We must make sure pointers don't escape.

Andrei

Reply via email to