Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

C++ std::span doesn't have comparison operators at all. If you were to write an equality operator you might use memcmp, in which case it will be exactly the same as memcmp, which LLVM will helpfully reinterpret as bcmp for best performance.

See for example the difference between std::string::operator== and just calling memcmp yourself: https://godbolt.org/z/qn1crox8c



  bcmp() is identical to memcmp(3); use it instead.


This is what we call "a lie". There's a reason the compiler generates bcmp instead.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: