Submitter:Fred J. Tydeman
Submission Date:2015-06-23
Document: WG14 N1944

Summary strcoll makes the assumption that the result of comparing two strings can only have one of three outcomes: greater than, equal to, or less than. However, there is a fourth outcome that is possible: not comparable.

I have been told that there are locales or codesets that have strings of bytes that do not form valid characters. Those invalid characters could be considered Not-a-Character (similar to Not-a-Number for floating-point). And, they are not comparable to anything.

I do not know if the same issue can apply to wchar_t. If so, then wcscmp(), wcsncmp(), and wmemcmp() have the same problem.

Suggested Technical Corrigendum

Replace the start of, paragraph 3,

The strcoll ...


If either string contains invalid characters, errno is set to an implementation defined value and the return value is unspecified; otherwise, errno is left alone and the strcoll ...

The same change should also be applied to wcscoll.