It acts like a 'break' statement for try block..You leave the block under some condition.
eg:
__try{
if (a==0) __leave;
b=c;
}
__finally{
printf("something");
}
Here if (a==0) condition fails it will directly come to __finally and prints...
I cannot use break here since it is used for either switch or for loop...
So I want some equivalent...I don't wanna use 'goto' here...Some alternative suggestion for g++ compiler is appreciable since __leave will not work for g++
How about
:
- __try{
-
if (a!=0) {
-
b=c;
-
}
-
}
-
__finally{
-
printf("something");
-
}
I dislike the use of break (except in the use of switch/case, as it is required in that case, but that structure should only be used if it has value), continue, goto and equivilant code as they make reading the flow more difficult by making multiple entry and restart points. It also makes the code harder to prove correct.
try/catch is an exception ('scuse the pun), as it is doing a specific seperation of normal code flow with exceptional code flow.
I also recommend the use of using braces for code blocks as it can make the intent clearer and reduces the number of avoidable errors.
Is there a reason why you are using MS SEH? Becareful if you use it along side of C++'s exception handling, I don't think that they play nice together.
Adrian