Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2444)

Unified Diff: base/string_util.h

Issue 517054: Remove all uses of EmptyString16(), EmptyWString(), and EmptyGURL(), and thei... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/autofill/address.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/string_util.h
===================================================================
--- base/string_util.h (revision 35729)
+++ base/string_util.h (working copy)
@@ -121,10 +121,15 @@
#error Define string operations appropriately for your platform
#endif
-// Returns a reference to a globally unique empty string that functions can
-// return. Use this to avoid static construction of strings, not to replace
-// any and all uses of "std::string()" as nicer-looking sugar.
-// These functions are threadsafe.
+// These threadsafe functions return references to globally unique empty
+// strings.
+//
+// DO NOT USE THESE AS A GENERAL-PURPOSE SUBSTITUTE FOR DEFAULT CONSTRUCTORS.
+// There is only one case where you should use these: functions which need to
+// return a string by reference (e.g. as a class member accessor), and don't
+// have an empty string to use (e.g. in an error case). These should not be
+// used as initializers, function arguments, or return values for functions
+// which return by value or outparam.
const std::string& EmptyString();
const std::wstring& EmptyWString();
const string16& EmptyString16();
« no previous file with comments | « no previous file | chrome/browser/autofill/address.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698