Date: Mon, 14 Sep 2020 03:19:22 -0700
On Sun, Sep 13, 2020 at 11:36 AM Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> On Sunday, 13 September 2020 11:08:17 PDT Nikolay Mihaylov wrote:
> > however, the compiler knows what strcmp is , so if you do
> > strcmp(a.c_str(), b.c_str()) == 0;
>
> No, you can't. That's not the same as the *correct* memcmp.
>
On a modern processor, strcmp is also much slower than memcmp. See
https://godbolt.org/z/a6W8ff for an example of how fast it can be to
compare equality to an 8-character string.
std-proposals_at_[hidden]> wrote:
> On Sunday, 13 September 2020 11:08:17 PDT Nikolay Mihaylov wrote:
> > however, the compiler knows what strcmp is , so if you do
> > strcmp(a.c_str(), b.c_str()) == 0;
>
> No, you can't. That's not the same as the *correct* memcmp.
>
On a modern processor, strcmp is also much slower than memcmp. See
https://godbolt.org/z/a6W8ff for an example of how fast it can be to
compare equality to an 8-character string.
Received on 2020-09-14 05:19:36