When I use throw
in a function, for example
try {
// ...
throw MyExceptionType()
// ...
} catch(MyExceptionType& exp){ /* ... */ }
Where is MyExceptionType
allocated? Is it on the stack? If so, is it safe to modify exp
in my catch
block? What about calling some other functions inside the catch
and use the stack?
In a similar case I have:
try {
char my_array[32];
throw my_array;
} catch(char* error_string){ /* ... */ }
Is error_string
pointing to somewhere in the process stack? Can I run over the array if I call some functions inside catch
block?