The strcoll function is intended to compare strings based on their
ordering in the current locale. Since the locale facilities have not yet
been added, a simple implementation that is the same as strcmp has been
added as a placeholder.
Details
- Reviewers
sivachandra lntue - Commits
- rGf418f8882490: [libc] add locale free strcoll
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libc/src/string/strcoll.cpp | ||
---|---|---|
20 | I think this is the same implementation as strcmp, but to avoid all type conversion/promotion confusions, we should cast the de-referenced value to int: int(*reinterpret_cast<const unsigned char *>(left)) | |
libc/test/src/string/strcoll_test.cpp | ||
23 | For completeness, you should add ASSERT_GT and ASSERT_LT tests also. |
address comments
libc/test/src/string/strcoll_test.cpp | ||
---|---|---|
23 | I'm avoiding adding GT and LT tests because they'll likely be wrong in some locales. Until we have a system for setting the locale per-test, similar to what we have for floating point rounding modes, any inequality comparison is unsafe. |
I think this is the same implementation as strcmp, but to avoid all type conversion/promotion confusions, we should cast the de-referenced value to int: