digitalmars.D.bugs - BUG: finally block executes multiple times
- Sean Kelly (28/28) Nov 16 2004 Executing the following code:
- Thomas Kuehne (17/38) Nov 17 2004 This version of the problem seems to be Windows-only. On Linux I get:
- Sean Kelly (9/22) Nov 17 2004 I was looking at the code for this yesterday and current behavior is to ...
Executing the following code: void main() { try { try { printf( "hello\n" ); throw new Exception( "first" ); } finally { printf( "finally\n" ); throw new Exception( "second" ); } } catch( Exception e ) { printf( "catch\n" ); e.print(); } } prints: hello finally finally .. (maybe 100 iterations) finally
Nov 16 2004
This version of the problem seems to be Windows-only. On Linux I get: error.html reads: Due to "catch( Exception e )" I would expect the output: Sean Kelly schrieb am Tue, 16 Nov 2004 20:23:32 +0000 (UTC):Executing the following code: void main() { try{ try{ printf( "hello\n" ); throw new Exception( "first" ); }finally{ printf( "finally\n" ); throw new Exception( "second" ); } } catch( Exception e ) { printf( "catch\n" ); e.print(); } } prints: hello finally finally .. (maybe 100 iterations) finallyAdded to DStress as: http://svn.kuehne.cn/dstress/run/finally_01.d Thomas
Nov 17 2004
In article <tgjr62-2vv.ln1 kuehne.cn>, Thomas Kuehne says...This version of the problem seems to be Windows-only. On Linux I get: error.html reads: Due to "catch( Exception e )" I would expect the output:I was looking at the code for this yesterday and current behavior is to find the exception handler for the original exception and then to evaluate all the "finally" blocks that were passed. So I suppose it makes sense that if one of these blocks throws an excecption it would be handled higher up in the program. I've posted a message in the main thread asking about what the correct behavior for this *should* be, as I'm not convinced either is correct. Still, the Windows bug should be fixed. Sean
Nov 17 2004