On Thu, 15 Apr 2010 10:24:07 -0400, Jesse Phillips <jessekphillip...@gmail.com> wrote:

Part of the reason D leaves undefined behavior is because you are
breaking compiler guarantees. Such as:

    char[] s = ...;
    immutable(char)[] p = cast(immutable)s;     // undefined behavior

This is not undefined behavior.  Continuing to use s would be.

I just wanted to make that clear. Except for strings, there is currently no way to generate immutable data except via casting. Don't use idup except on pure value types, that is currently unsafe, see http://d.puremagic.com/issues/show_bug.cgi?id=3550

-Steve

Reply via email to