Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Qpid Wiki" for change 
notification.

The following page has been changed by AlanConway:
http://wiki.apache.org/qpid/CppTips/BewareStdStringLiterals

------------------------------------------------------------------------------
  The short story: in C++ code using `std::string` never use string literals 
except to initialize static-scoped `std::string` constants.
- (And by the way: NeverUseStaticLocalVariables)
+ (And by the way: CppTips/NeverUseStaticLocalVariables)
  
  The long story: `std::string` is all about avoiding copies. Reference 
counting and copy-on-write serve to maximise the sharing of a single 
heap-allocated char array while maintaining memory safety. When used 
consistently in a program it works rather nicely.
  
@@ -31, +31 @@

  void f() { std::string x; while (x != end) {...} }
  }}}
  
- And once again NeverUseLocalStaticVariables.
+ And once again CppTips/NeverUseLocalStaticVariables.
  

Reply via email to