scope(success) lowered to try-catch ?
Cauterite
cauterite at gmail.com
Sun Jun 17 10:58:29 UTC 2018
Hello,
I'm not sure whether I'm missing something obvious here, but is
there a reason for scope(success) being lowered to a try-catch
statement?
I would have expected only scope(exit) and scope(failure) to
actually interact with exception handling, while scope(success)
simply places code on the path of normal control flow.
Example (windows x32):
---
// main.d
void main() {
scope(success) {}
}
> dmd -betterC main.d
Error: Cannot use try-catch statements with -betterC
---
Regardless of whether -betterC is used, you can see in the
disassembly that having a scope(success) anywhere in the function
causes the SEH prologue to be emitted in the code.
Is there a reason scope(success) needs to set up for exception
handling?
Or is this a bug / potential enhancement ?
More information about the Digitalmars-d-learn
mailing list