[MECpp]Item-14 Use Exception Specifications Judiciously
· ☕ 3 min read

Exception specifications provide a documentation aid and an enforcement mechanism for constraints on exception usage, but they are only partly checked by compilers and they are easy to violate inadvertently.


[MECpp]Item-13 Catch Exceptions by Reference
· ☕ 2 min read

If catching by reference, we sidestep the questions about object deletion, avoid slicing exception objects, retain the ability to catch standard exceptions, and limit the number of times exception objects being copied.


[MECpp]Item-11 Prevent Exceptions From Leaving Destructors
· ☕ 2 min read

Keep exceptions from propagating out of destructors to prevent C++ calling terminate during the statck-unwinding part of exception propagation and ensure that every neccessary cleanup is accomplished.


[MECpp]Item-10 Prevent Resource Leaks in Constructors
· ☕ 7 min read

Replace pointer class members with their corresponding smart pointer objects to fortify the constructors against resource leaks in the presence of exceptions, to eliminate the need to manually deallocate resources in destructors, and to allow const member pointers to be handled in the smae graceful fashion as non-const pointers.