www.digitalmars.com         C & C++   DMDScript  

D - Dernel: how does exception handling work?

reply "=?iso-8859-1?Q?Robert_M._M=FCnch?=" <robert.muench robertmuench.de> writes:
Hi, I had a problem with my code bombing and I found out that it was a  
problem with a "switch" statement not having a "default" choice. The D  
compiler inserted code that in this case a SwitchError is thrown.

What do I need to support, that this throw stuff works? What does the D  
compiler expect to find (exception tables, etc.)?

-- 
Robert M. Münch
Management & IT Freelancer
http://www.robertmuench.de
Feb 20 2004
parent reply "Walter" <walter digitalmars.com> writes:
"Robert M. Münch" <robert.muench robertmuench.de> wrote in message
news:opr3ohlty3heztw6 news.digitalmars.com...
 Hi, I had a problem with my code bombing and I found out that it was a
 problem with a "switch" statement not having a "default" choice. The D
 compiler inserted code that in this case a SwitchError is thrown.

 What do I need to support, that this throw stuff works? What does the D
 compiler expect to find (exception tables, etc.)?

I don't understand the question. But to fix the problem with the switch, add a default case.
Feb 20 2004
parent reply "=?iso-8859-1?Q?Robert_M._M=FCnch?=" <robert.muench robertmuench.de> writes:
On Fri, 20 Feb 2004 09:52:11 -0800, Walter <walter digitalmars.com> wrote:

 I don't understand the question. But to fix the problem with the switch,  
 add a default case.

Hi Walter, ;-) yes I did this. The problem I get is a stack problem, ESP isn't set right or so. My question is: Do I need to support something special (interrupt, exception handling of the Intel hardware etc.) so that the D compiler generated exception handling code works? -- Robert M. Münch Management & IT Freelancer http://www.robertmuench.de
Feb 20 2004
parent "Walter" <walter digitalmars.com> writes:
"Robert M. Münch" <robert.muench robertmuench.de> wrote in message
news:opr3onpfkmheztw6 news.digitalmars.com...
 On Fri, 20 Feb 2004 09:52:11 -0800, Walter <walter digitalmars.com> wrote:

 I don't understand the question. But to fix the problem with the switch,
 add a default case.

Hi Walter, ;-) yes I did this. The problem I get is a stack problem, ESP isn't set right or so. My question is: Do I need to support something special (interrupt, exception handling of the Intel hardware etc.) so that the D compiler generated exception handling code works?

Exception handling is done differently under win32 and linux. The linux version is more OS independent, so if doing a D kernel, I'd go that route.
Feb 20 2004