September 07 [Issue 24749] New: A clause consisting only of "throw" should be the unlikely path | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24749 Issue ID: 24749 Summary: A clause consisting only of "throw" should be the unlikely path Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: bugzilla@digitalmars.com As suggested by Quirin Schroll. int foo(int i) { if (i) throw new Exception("hello"); return i; } should emit code this way: int foo(int i) { if (!i) return i; throw new Exception("hello"); } so the return statement is considered the most likely code execution path. -- |
Copyright © 1999-2021 by the D Language Foundation