Effective C++ Ed. 3rd: Item 26. Postpone variable definitions as long as possible

  1. Postpone a variable's definition until right before you have to use the variable
  2. Try to postpone the definition until you have initialization arguments for it. 
  3. By doing so, you avoid constructing and destructing unneeded objects, and you avoid unnecessary default constructions. 
  4. This help document the purpose of variables by initializing them in contexts in which their meaning is clear.
prev | next

    No comments:

    Post a Comment