Talk:cpp/string/byte/strncmp
From cppreference.com
< Talk:cpp | string/byte
Why std::strncmp() behavior differ from C strncmp()? Looks like a mistake -- they should be identical. Same for wcsncmp(). 98.196.187.189 09:59, 30 August 2016 (PDT)MK
- because different contributors worked on them. I don't see mistakes in cpp/string/byte/strncmp vs c/string/byte/strncmp, the C side highlights a couple things that may not be immediately obvious: feel free to harmonize them. c/string/wide/wcsncmp was indeed outdated, updated it to match cpp/string/wide/wcsncmp. --Cubbi (talk) 11:29, 30 August 2016 (PDT)
- The C++ reference says "null-terminated byte strings" while the C reference says "possibly null-terminated arrays". Those are not the same thing. The C-standard itself only says "characters that follow a null character are not compared" and so the C-reference appears correct and the C++ reference incorrect.