EricWF updated this revision to Diff 33368.
EricWF added a comment.
Remove unnecessary call to `std::min`.
http://reviews.llvm.org/D12355
Files:
include/string
Index: include/string
===
--- include/string
+++ include/string
@@
mclow.lists added a comment.
The first change LGTM. The second one needs to match it.
Comment at: include/string:3816
@@ -3808,2 +3815,3 @@
+return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0;
}
You'll want to do the same as above here.
mclow.lists added a comment.
I think I'd rather see the call to `strcmp` and `wcscmp` in the char_traits
class.
http://reviews.llvm.org/D12355
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
bkramer added a subscriber: bkramer.
bkramer added a comment.
Won't this do the wrong thing for embedded '\0' in a std::string?
std::string(hello\0world, 11).compare(hello)
should not return 0.
http://reviews.llvm.org/D12355
___
cfe-commits
EricWF added a comment.
In http://reviews.llvm.org/D12355#233477, @bkramer wrote:
Won't this do the wrong thing for embedded '\0' in a std::string?
std::string(hello\0world, 11).compare(hello)
should not return 0.
Woops. Yep that seems correct but it will sure hamper the possibility
EricWF created this revision.
EricWF added a reviewer: mclow.lists.
EricWF added a subscriber: cfe-commits.
This patch optimizes basic_string::compare to use strcmp when the default
char_traits has been given.
See PR19900 for more information. https://llvm.org/bugs/show_bug.cgi?id=19900
mclow.lists added a comment.
In http://reviews.llvm.org/D12355#233477, @bkramer wrote:
Won't this do the wrong thing for embedded '\0' in a std::string?
std::string(hello\0world, 11).compare(hello)
should not return 0.
Good point; I think that pretty much kills this proposed change.