[Issue 23472] scope(sucess) generate exception handling code.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 9 16:18:57 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23472
kinke <kinke at gmx.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kinke at gmx.net
--- Comment #1 from kinke <kinke at gmx.net> ---
The frontend lowers this to:
```
char inc(string s, ref int i)
{
bool __os2 = false;
try
{
try
{
return s[cast(ulong)i];
}
catch(Throwable __o3)
{
__os2 = true;
throw __o3;
}
}
finally
if (!__os2)
i++;
}
```
So the increment is to be skipped if the bounds check fails. Using -release
etc. allows the LLVM optimizer to get rid of all EH boilerplate.
--
More information about the Digitalmars-d-bugs
mailing list