+ 1

Exception guarantee types

Hi I heard about exception guarantee and it has theee types as below: minimum guarantee strong guarantee No exception guarantee What does this mean? Would be helpful if some sample code and/or link is shared or Explained these terms in a bit details. Also what is importance of these guarantees? I am aware about no exception as it allows move constructor usage in stl. What is importance of other two ?

4th Apr 2024, 5:50 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
2 Réponses
+ 1
Having exception guarantees is like different levels of promises made when things go wrong in code. Minimum guarantee ensures that the object's state remains valid, even if an exception is thrown. Strong guarantee ensures that if an operation fails, the object is left unchanged, as if the operation never occurred. No exception guarantee means that no exceptions will be thrown during the operation. These guarantees are important for maintaining program stability and data consistency. For more details you can check out this stack overflow problem: https://stackoverflow.com/questions/62239627/c-why-does-this-have-a-strong-exception-guarantee
12th Apr 2024, 1:13 PM
`ᴴᵗᵗየ
`ᴴᵗᵗየ - avatar
+ 1
Thanks. Let me check this
12th Apr 2024, 2:37 PM
Ketan Lalcheta
Ketan Lalcheta - avatar