Hi,
I am throwing a structure from within my class which contains specific error information.
Would anyone be able to tell me if it is stack safe or not. Because I declare an instance
of the structure on the stack, and then assign data to the members of the struct. For example,
this wont compile... just for illustration purposes. Is it safe to process the error in this way?
Code:#include <iostream> using namespace std; struct ErrorInfo { CString cStrErrorMsg; CString cStrAdditional; }; func1(void); func2(void); int main(void) { try { func1(); } catch(ErrorInfo error) { cout << error.cStrErrorMsg << " " << error.cStrAdditional << "." } return 0; } func1(void) { try { func2(); } catch(ErrorInfo error) throw; } func2(void) { ErrorInfo error error.cStrErrorMsg = "Error Occured"; error.cStrAdditional = "Nothing"; throw error; }