[Issue 12028] New: Disallow side effects in asserts

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 29 08:25:02 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12028

           Summary: Disallow side effects in asserts
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2014-01-29 08:25:00 PST ---
I suggest to statically disallow code like this, that is to disallow side
effects in assert(), that are source of bugs (because the code can act
differently in release mode):


int foo(ref int y) pure nothrow {
    return y++;
}
void main() {
    int x;
    assert(++x);
    assert(foo(x));
}

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


More information about the Digitalmars-d-bugs mailing list