Hi
Just to make sure, if there is goto from within try block then we will not arrive to finally, correct?
Thanks
Hi
Just to make sure, if there is goto from within try block then we will not arrive to finally, correct?
Thanks
'finally' - are you referring to structured exception handling or C++ handling?
There is no finally block for exception handling in standard C++. If you really are asking with respect to some C++ compiler extension, then you should provide more details on the compiler that you have in mind. Oh, and a code example can help.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
I think the more relevant question is: is there anything you can do to eliminate that goto? it's true that there are situations where a goto is the only/best option, but I think you should evaluate your code and determine if there's a better way in your case.
VS.
Of course the code isn't mine, I need to maintain it while doing minimum changes.
But you still haven't given enough detail. Are you using a compiler with an extension that has a "finally" block? Can you post some code?
Do you mean __finally from SEH exception handling?
Give us a quick sample of what the code looks like.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
I've made many mistakes over the years doing things the dumb way in an attempt to have "low impact" on the code I'm working on. It has lead to many very embarrassing, funny, and depressing outcomes. If you fear the code you won't have the courage to make the correct changes to it. Often there is an air of mystery or superstition surrounding such code. Look at it wrong and it might run over your mother in the parking lot.
Let me tell you, from experience, any problems you imagine you might have from changing this code, pale in comparison to the trouble you're in for if you continue to pile hack upon hack on top of it. If this code is truly a Jenga tower ready to crumble at the slightest touch, do you really think sticking a goto into it will improve matters?
Code://try //{ if (a) do { f( b); } while(1); else do { f(!b); } while(1); //}
Just to say, I already gave up and changed this stupid goto
Anyway currently there is no finally there.
Let's say that is __finally
Does goto from catch make __finally irrelevant?
You are mixing C++ exceptions with Structured Exception Handling (a compiler/platform specific extension used mainly on Windows). Have a read up on SEH to find out more - Introduction to Exception Handling