Reputation: 6137
this is the error I'm receiving:
I would like to know this:
try catch
block to handle that error?
ORtry catch
is not possible?I'm receiving this error when I call a member function trough pointer to member function with wrong signature. That error of course won't happen if I call it with correct signature , but, I just wanna know how do I handle it if it happens.
Upvotes: 1
Views: 805
Reputation: 63735
1. You can't handle that error with try
/catch
.
This is because try
/catch
relies on the call stack and your error is that your call stack is corrupted.
2. There is no reasonable runtime method to know in advance that code is going to corrupt the stack.
These problems are typically handled by using caution when casting (function) pointers in the code itself. The compiler will not allow an incorrect function pointer assignment unless you're forcing it with a cast.
Upvotes: 2
Reputation: 249123
You cannot catch
a function call with the wrong calling convention, because it is not an exception in C++ terms. The error is a potentially fatal one which has to do with the structure or formulation of the program, and you should not attempt to "handle" it unless you are doing some serious low-level backward compatibility stunts a la Raymond Chen.
Upvotes: 0