[PATCH] D26646: Avoid calling std::memcmp with nullptr

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 16:01:20 PST 2016


zturner added a comment.

In https://reviews.llvm.org/D26646#595108, @ruiu wrote:

> Do you mean that if it is called with "", such as `StartsWith("", foo)`, S becomes a nullptr?


Were you asking me?  My comment is just saying that string literal is not the only way to invoke this overload.  You can invoke it with a char array too, and `strlen(char_array)` is not guaranteed to be the same as `sizeof(char_array) - 1`.


https://reviews.llvm.org/D26646





More information about the llvm-commits mailing list