KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
By Abrahams we have 3 types of exception : Nothrow Basic exception guarantee Strong exception guarantee Basic means ( please correct me if I'm wrong ) that Invariants are preserved e.g that the invariants of the component are preserved, and no resources are leaked , where Strong that the operation has either completed successfully or thrown an exception, leaving the program state exactly as it was before the operation started . What does it mean that Invariants are preserved ? that if I have a valid value in one of my variables then it wouldn't (take for example a pointer) hold a NULL ? Referring to Strong exception guarantee , does it mean that all my variables would store the exact same values before the exception was thrown ? for example : int main() { int j = 1; int *p = &j; // do some stuff j = 2; throw 1; } Then after I throw , j would hold the value 2 or 1 ? Regards
Tags (comma-separated)
Save Edits
Cancel