<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 10/08/2018 10:05 PM, Markus Scherer
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAN49p6o19h=Pq4guSts8WJtL72CStQgxvNuRfAxuSTyTuGhFfw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr">On Mon, Oct 8, 2018 at 6:14 PM Lyberta <<a
href="mailto:lyberta@lyberta.net" moz-do-not-send="true">lyberta@lyberta.net</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">> If you do want a
distinct type, why not just standardize on uint8_t? Why<br>
> does it need to be a new type that is distinct from
that, too?<br>
<br>
Here's a small example why both "char" and "uint8_t" are
horrible types<br>
as implemented now on all major implementations:<br>
<br>
<br>
std::uint8_t small_number = 65;<br>
std::cout << small_number << '\n';<br>
<br>
This will print "A" instead of 65 on all implementations
I've tested it<br>
on. This breaks templates that do text processing.</blockquote>
<div><br>
</div>
<div>Hm? This has very little to do with text processing.
Someone made a choice that ostream << small number
yields a character.</div>
</div>
</div>
</div>
</blockquote>
<br>
I think it is a relevant example. The concern is the inability to
differentiate character data vs numeric data due to uint8_t being a
typedef of another type that might be a character type (unsigned
char) or numeric type (unsigned short) depending on the
implementation.<br>
<br>
<blockquote type="cite"
cite="mid:CAN49p6o19h=Pq4guSts8WJtL72CStQgxvNuRfAxuSTyTuGhFfw@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
<div>If you want specific formatting of a value, you
implement and call a value formatter function that returns
a string.</div>
<div>Or you define a value class and define << for it.</div>
</div>
</div>
</div>
</blockquote>
<br>
I agree this is a better practice.<br>
<br>
<blockquote type="cite"
cite="mid:CAN49p6o19h=Pq4guSts8WJtL72CStQgxvNuRfAxuSTyTuGhFfw@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"> Personally, I think<br>
we need to add "char8_t" and also a "shortest" type so
implementations<br>
can use "unsigned shortest" to implement std::uint8_t.</blockquote>
<div><br>
</div>
<div>That's called uint_least8_t, right? If it was smaller
than 8 bits, it would be useless for UTF-8.</div>
</div>
</div>
</div>
</blockquote>
<br>
I believe Lyberta is arguing for a small builtin integer type that
is not defined in terms of a type that may be confused as being a
character type.<br>
<br>
<blockquote type="cite"
cite="mid:CAN49p6o19h=Pq4guSts8WJtL72CStQgxvNuRfAxuSTyTuGhFfw@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
<div>And I doubt that there is any platform that supports
C++11 or higher and where uint8_t != uint_least8_t.</div>
</div>
</div>
</div>
</blockquote>
<br>
I hope that is true. But there are platforms where uint8_t is not
available because uint_least8_t is larger than 8 bits.<br>
<br>
Tom.<br>
<br>
<blockquote type="cite"
cite="mid:CAN49p6o19h=Pq4guSts8WJtL72CStQgxvNuRfAxuSTyTuGhFfw@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
<div>markus</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
SG16 Unicode mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Unicode@isocpp.open-std.org">Unicode@isocpp.open-std.org</a>
<a class="moz-txt-link-freetext" href="http://www.open-std.org/mailman/listinfo/unicode">http://www.open-std.org/mailman/listinfo/unicode</a>
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>