Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. int outer_API_bar()
  2. {
  3. // Modify internal state
  4. internal_foo()
  5. }
  6.  
  7. int internal_foo()
  8. {
  9. // Do stuff
  10.  
  11. if (internal_state_variable)
  12. {
  13. // Do some more stuff
  14. internal_state_variable = false;
  15. }
  16. }
  17.  
  18. int outer_API_bar()
  19. {
  20. // Modify internal state
  21.  
  22. internal_foo(internal_state_variable)
  23.  
  24. // This could be another function if repeated many
  25. // times in the module
  26. if (internal_state_variable)
  27. {
  28. internal_state_variable = false;
  29. }
  30. }
  31.  
  32. int internal_foo(bool arg)
  33. {
  34. // Do stuff
  35.  
  36. if (arg)
  37. {
  38. // Do some more stuff
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement