digitalmars.D - More LDC Exception Handling Stuff
- dsimcha (10/10) Dec 31 2008 When people say that exception handling doesn't work on LDC in some
- Frits van Bommel (19/29) Jan 01 2009 Even "uncaught" exceptions get caught by the runtime.
- Christian Kamm (7/14) Jan 01 2009 That really depends. It could mean that exception handling is buggy (LLV...
- Don (2/20) Jan 01 2009 Does that mean that it compiles, at least?
- Christian Kamm (3/23) Jan 01 2009 LDC, the runtime, tango-user, code using exception handling - all on x86...
- Don (2/26) Jan 02 2009 That's what I wanted to hear. That's great news.
When people say that exception handling doesn't work on LDC in some circumstances, does this mean that if the code uses exceptions it won't work, that you can't catch exceptions or something else? If you just can't catch exceptions, it could still be useful to me for some data mining code that I sometimes write that has huge memory requirements (meaning I need 64-bit) but absolutely no robustness requirements (I pretty much treat all exceptions as unrecoverable because the program will only be run a few times and worrying about these details is a waste of my time.) Would I be able to use LDC on platforms where exception handling isn't supported, with library code that throws exceptions, as long as I didn't care about catching these exceptions?
Dec 31 2008
dsimcha wrote:When people say that exception handling doesn't work on LDC in some circumstances, does this mean that if the code uses exceptions it won't work, that you can't catch exceptions or something else? If you just can't catch exceptions, it could still be useful to me for some data mining code that I sometimes write that has huge memory requirements (meaning I need 64-bit) but absolutely no robustness requirements (I pretty much treat all exceptions as unrecoverable because the program will only be run a few times and worrying about these details is a waste of my time.) Would I be able to use LDC on platforms where exception handling isn't supported, with library code that throws exceptions, as long as I didn't care about catching these exceptions?Even "uncaught" exceptions get caught by the runtime. Last I checked on my (x86-64 Linux) machine, this code segfaults in the runtime when compiled with LDC: ----- void main() { throw new Exception("test"); } ----- I'm not sure what the throwing code does if you set rt_trapExceptions to false. It might just terminate the program, so try it and see; add something like the following code to one of your modules: ----- extern extern (C) bool rt_trapExceptions; static this() { rt_trapExceptions = false; } ----- (Note: This only works with Tango)
Jan 01 2009
dsimcha wrote:When people say that exception handling doesn't work on LDC in some circumstances, does this mean that if the code uses exceptions it won't work, that you can't catch exceptions or something else?That really depends. It could mean that exception handling is buggy (LLVM bug in x86-64) or that something is fundamentally amiss (Windows) and unwinding the stack to the correct catch clause does not work. In the latter case, we make 'throw' print out a message and terminate the program instead.Would I be able to use LDC on platforms where exception handling isn't supported, with library code that throws exceptions, as long as I didn't care about catching these exceptions?I'd expect so, though it hasn't been tried.
Jan 01 2009
Christian Kamm wrote:dsimcha wrote:Does that mean that it compiles, at least?When people say that exception handling doesn't work on LDC in some circumstances, does this mean that if the code uses exceptions it won't work, that you can't catch exceptions or something else?That really depends. It could mean that exception handling is buggy (LLVM bug in x86-64) or that something is fundamentally amiss (Windows) and unwinding the stack to the correct catch clause does not work. In the latter case, we make 'throw' print out a message and terminate the program instead.Would I be able to use LDC on platforms where exception handling isn't supported, with library code that throws exceptions, as long as I didn't care about catching these exceptions?I'd expect so, though it hasn't been tried.
Jan 01 2009
Don wrote:Christian Kamm wrote:LDC, the runtime, tango-user, code using exception handling - all on x86-32 or x86-64 Linux: yes, they do compile. Did I misunderstand the question?dsimcha wrote:Does that mean that it compiles, at least?When people say that exception handling doesn't work on LDC in some circumstances, does this mean that if the code uses exceptions it won't work, that you can't catch exceptions or something else?That really depends. It could mean that exception handling is buggy (LLVM bug in x86-64) or that something is fundamentally amiss (Windows) and unwinding the stack to the correct catch clause does not work. In the latter case, we make 'throw' print out a message and terminate the program instead.Would I be able to use LDC on platforms where exception handling isn't supported, with library code that throws exceptions, as long as I didn't care about catching these exceptions?I'd expect so, though it hasn't been tried.
Jan 01 2009
Christian Kamm wrote:Don wrote:That's what I wanted to hear. That's great news.Christian Kamm wrote:LDC, the runtime, tango-user, code using exception handling - all on x86-32 or x86-64 Linux: yes, they do compile. Did I misunderstand the question?dsimcha wrote:Does that mean that it compiles, at least?When people say that exception handling doesn't work on LDC in some circumstances, does this mean that if the code uses exceptions it won't work, that you can't catch exceptions or something else?That really depends. It could mean that exception handling is buggy (LLVM bug in x86-64) or that something is fundamentally amiss (Windows) and unwinding the stack to the correct catch clause does not work. In the latter case, we make 'throw' print out a message and terminate the program instead.Would I be able to use LDC on platforms where exception handling isn't supported, with library code that throws exceptions, as long as I didn't care about catching these exceptions?I'd expect so, though it hasn't been tried.
Jan 02 2009