[PATCH] D12355: [libcxx] Optimize away unneeded length calculation in basic_string::compare(const char*)

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 26 13:11:36 PDT 2015


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 for optimization.


http://reviews.llvm.org/D12355





More information about the cfe-commits mailing list