-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[Proposal] Clarify (the existence of) the constant empty String #5546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
instead of use of naked global symbol.
afd32a7
to
9335115
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the way this was factored, very clean!
@@ -70,6 +72,9 @@ class String { | |||
explicit String(double, unsigned char decimalPlaces = 2); | |||
~String(void); | |||
|
|||
// empty string singleton | |||
static constexpr const String& empty = ::__emptyString; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't call the static member "empty". It should be ok to also call it "emptyString", because it is scoped, or call it something else (emptyStr, nullString, defString, etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the deprecation, can this be implemented the other way around? make this member the "real" object, and make the global a reference to this one.
@jjsuwa ping! |
@jjsuwa Are you going to make a new PR for this ? |
instead of use of naked global symbol.