473,386 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

should finally block be the last executing block in a function?

After finally block executes, the control goes back to the
caller..I was expecting the control to go to the next
statement after the finally block. Thanks for your input.
Nov 16 '05 #1
1 1924
<an*******@discussions.microsoft.com> wrote:
After finally block executes, the control goes back to the
caller..I was expecting the control to go to the next
statement after the finally block. Thanks for your input.


It depends on what happened in the try block. If an exception was
thrown, or the method returned, then the method will be popped off the
stack. Otherwise, control will indeed go to the next statement after
the finally block.

Could you post a short example of some code which defies your
expectations?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Brian Alexander | last post by:
Hello; I'm curious to know how people preserve exceptions that arise in a try ... finally block. Consider this example: try: getResource() doSomething() finally: alwaysFreeResource()
12
by: Brian Kelley | last post by:
def res(): try: a = 1 return finally: print "do I get here?" res() outputs "do I get here?"
16
by: Bill | last post by:
Say I have a childThread currently is running a finally block to cleanup external resources. At the same time the main thread calls childThread.Abort(). The question is: when the...
8
by: Z D | last post by:
Hi, I was wondering what's the point of "finally" is in a try..catch..finally block? Isn't it the same to put the code that would be in the "finally" section right after the try/catch block?...
1
by: | last post by:
After finally block executes, the control goes back to the caller..I was expecting the control to go to the next statement after the finally block. Thanks for your input.
6
by: Tilfried Weissenberger | last post by:
Hi, I am a bit confused as to what the FINALLY block is meant for. What's the difference between: this.Cursor = Cursors.WaitCursor; try { //do some stuff } catch { //handle exception }...
4
by: Cameron Frasnelly | last post by:
The second to last lin of code in the below sub is causing VS2003 to tell me that "Name 'SqlDR' is not declared" when obviously it is. It's also used just fine in the main code... any ideas???? ...
3
by: Arnaud Diederen | last post by:
Hello, I've been looking in the archives but found no interesting answer to my problem. I was wondering why the following code does not work in IE 5; I'd expect an alert showing 'In finally!',...
13
by: Jon Davis | last post by:
I understand that the finally sub-block will execute regardless of whether try succeeded or not. But so will code that follows try...catch. So then what is the difference between ... try {...
3
by: Jeff | last post by:
..NET 2.0 Lets say I have this code: public int test () { string s = "hello world" try { int i = 4;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.