Foo2 is called in the loop or breaks with SIGSEGV. Maybe it has something todo with threads, because I use all my exception inside one thread and haven't changed CEXCEPTION_NUM_ID and CEXCEPTION_GET_ID
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If all of your Try's and Throws are within a single thread/task/etc… you should be fine. You only need to define those macros if there is a chance of getting a mismatch (a throw in one thread should not be caught by another thread, etc).
I'm making an assumption that you have a Try…Catch somewhere around the one that you are listing (nested directly outside or around this function when it gets called, etc). If not, your error is that your second throw never gets caught anywhere. There's not a global catch anywhere to grab it for you.
If both of those items are okay, then I'll need a bit more detail to help you out. Can you paste in a more complete example that reproduces the problem? What compiler are you using?
Mark
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can I use CException to generate an Exception inside the Try-Catch block?
Something like that:
Yes, you can absolutely do this. In fact, I often use it to clean things up (release a semaphore, etc) before rethrowing an error, like so:
Then your error will get thrown to the next nested Catch. :)
It doesn't work for me.
Foo2 is called in the loop or breaks with SIGSEGV. Maybe it has something todo with threads, because I use all my exception inside one thread and haven't changed CEXCEPTION_NUM_ID and CEXCEPTION_GET_ID
If all of your Try's and Throws are within a single thread/task/etc… you should be fine. You only need to define those macros if there is a chance of getting a mismatch (a throw in one thread should not be caught by another thread, etc).
I'm making an assumption that you have a Try…Catch somewhere around the one that you are listing (nested directly outside or around this function when it gets called, etc). If not, your error is that your second throw never gets caught anywhere. There's not a global catch anywhere to grab it for you.
If both of those items are okay, then I'll need a bit more detail to help you out. Can you paste in a more complete example that reproduces the problem? What compiler are you using?
Mark
My function:
I removed all threads from my application and foo2 is still called in the loop. I just can't understand how it could be possible.
Compiler:
I found the answer in the documentation! It is not allowed to use the return statement(or break in my case).
:) Yes, you found it.