NB: I'm sure someone will call this subjective, but I reckon it's fairly tangible.
C++11 gives us new basic_string
types std::u16string
and std::u32string
, type aliases for std::basic_string<char16_t>
and std::basic_string<char32_t>
, respectively.
The use of the substrings "u16"
and "u32"
to me in this context rather implies "UTF-16" and "UTF-32", which would be silly since C++ of course has no concept of text encodings.
The names in fact reflect the character types char16_t
and char32_t
, but these seem misnamed. They are unsigned, due to the unsignedness of their underlying types:
[C++11: 3.9.1/5]:
[..] Typeschar16_t
andchar32_t
denote distinct types with the same size, signedness, and alignment asuint_least16_t
anduint_least32_t
, respectively [..]
But then it seems to me that these names violate the convention that such unsigned types have names beginning 'u'
, and that the use of numbers like 16
unqualified by terms like least
indicate fixed-width types.
My question, then, is this: am I imagining things, or are these names fundamentally flawed?