Advertisement
tinyevil

Untitled

Nov 5th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. class Ctx{
  2. public:
  3.     void foo1(){
  4.         depth++;
  5.         foo2();
  6.         depth--;
  7.     }
  8.  
  9.     void foo2(){
  10.         if ( something ){
  11.             foo1();
  12.         }else if ( something2 ){
  13.             try{
  14.                 foo_try_this_one();
  15.             }catch(Exception&){
  16.                 foo_backup(); // here the depth may become invalid
  17.             }
  18.         }else{
  19.             ...
  20.         }
  21.     }
  22.  
  23.     void foo_try_this_one();
  24.     void foo_backup();
  25.  
  26.     int depth;
  27. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement