Ray's playground

 

Item29: Strive for exception-safe code.(Effective C++)

  • Exception-safe functions leak no resources and allow no data structures to become corrupted, even when exceptions are thrown. Such functions offer the basic, strong, or nothrow guarantees.

  • The strong guarantee can often be implemented via copy-and-swap, but the strong guarantee is not practical for all functions.

  • A function can usually offer a guarantee no stronger than the weakest guarantee of the functions it calls.

posted on 2011-03-30 23:33  Ray Z  阅读(291)  评论(0编辑  收藏  举报

导航