[Issue 23472] scope(sucess) generate exception handling code.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 9 18:57:27 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=23472

--- Comment #3 from kinke <kinke at gmx.net> ---
> so there is no reason to emit any exception handling code ever when
> dealing with scope(success).

That only holds for trivial code like your example. With multiple return
statements like

char inc(string s, ref int i) {
    scope(success) i++;
    if (s == null)
        return 0;
    if (s.length > 256)
        return 1;
    return s[i];
}

the general frontend lowering does make sense, IMO at least. ;)

--


More information about the Digitalmars-d-bugs mailing list