[Issue 7595] Data being overwritten.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 4 12:59:58 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7595


Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com


--- Comment #2 from Walter Bright <bugzilla at digitalmars.com> 2012-03-04 12:59:52 PST ---
bug.d reduces to:
-----------------
@trusted:

import core.stdc.stdio;
import std.datetime : benchmark;

struct Matrix {
    int[4] _data;
}

void inverse(const ref Matrix m)  {
    for (size_t i = 0; i < 4; i++)
        printf("m._data[%d] = %d\n", i, m._data[i]);
}

unittest {
    Matrix m9;
    m9._data[0] = 1;
    m9._data[1] = 2;
    m9._data[2] = 3;
    m9._data[3] = 4;
    for (size_t i = 0; i < 4; i++)
        printf("m9._data[%d] = %d\n", i, m9._data[i]);

    benchmark!( { inverse(m9);} )(1);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list