Subject: Re: [SG16-Unicode] Draft SG16 direction paper
From: Lyberta (lyberta_at_[hidden])
Date: 2018-10-08 20:05:00
> As for char8_t, I realize that you think the benefits outweigh the costs.
> I asked some C++ experts about the potential for performance gains from
> better optimizations; one responded with a skeptical note.
> If you do want a distinct type, why not just standardize on uint8_t? Why
> does it need to be a new type that is distinct from that, too?
Here's a small example why both "char" and "uint8_t" are horrible types
as implemented now on all major implementations:
std::uint8_t small_number = 65;
std::cout << small_number << '\n';
This will print "A" instead of 65 on all implementations I've tested it
on. This breaks templates that do text processing. Personally, I think
we need to add "char8_t" and also a "shortest" type so implementations
can use "unsigned shortest" to implement std::uint8_t. By the way, they
really should use extended integer type but I guess that would break the
code that assumes that std::uint8_t* has same aliasing properties as
char*. I think this code deserves to be broken and compilers should warn
"char" is hands down the worst feature of both C and C++. C++ tries to
bandaid over it but fails spectacularly in most cases. I think we as
software developers should forget about "char" type. In fact, I think we
should forget of any "character" type in any programming language.
But I'm a purist. The world will move very slowly.
SG16 list run by herb.sutter at gmail.com