Add "leave" keyword for escaping exception frames #1577
Replies: 4 comments
-
Ok... so what is the advantage over goto? |
Beta Was this translation helpful? Give feedback.
-
"C-style error cleanup" doesn't exactly sound like a tempting thing to have in C#. (Wouldn't error cleanup typically happen inside Could you perhaps show an example of what a typical, good use of |
Beta Was this translation helpful? Give feedback.
-
If I'm understanding right, inverting an |
Beta Was this translation helpful? Give feedback.
-
That sounds like a pretty specific optimization for Visual C++. Considering that C# already emits |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Microsoft's C++ has a __leave keyword for Structured Exception Handling (SEH) which is essentially a "break" for try-catch scopes. It immediately causes flow to exit the try scope and enter the finally scope. It's fantastic for setting up rigid C-style error cleanup without using a goto. This keyword if brought to C# would have strong precedent and get a lot of use.
For reference:
https://msdn.microsoft.com/en-us/library/9xtt5hxz.aspx
Beta Was this translation helpful? Give feedback.
All reactions