220 29338 <68625755-8e0d-4030-afd5-d081371f7295@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: mihailnajdenov@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: std::byte thoughts
Date: Wed, 2 Nov 2016 02:27:17 -0700 (PDT)
Lines: 178
Approved: news@gmane.org
Message-ID: <68625755-8e0d-4030-afd5-d081371f7295@isocpp.org>
References: <7da80620-e4bd-40eb-a4ec-4f3c2dcb2c98@isocpp.org> <2350841.Z7lUCKSumT@tjmaciei-mobl1> <3e64b220-79ae-4108-ba1c-9785494fc434@isocpp.org>
 <2128372.NTAZafObDQ@tjmaciei-mobl1>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1661_2064418561.1478078837367"
X-Trace: blaine.gmane.org 1478078842 6165 195.159.176.226 (2 Nov 2016 09:27:22 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 2 Nov 2016 09:27:22 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCUJ3A7GRAPRB5XC43AAKGQEV4FJAUA@isocpp.org Wed Nov 02 10:27:18 2016
Return-path: <std-proposals+bncBCUJ3A7GRAPRB5XC43AAKGQEV4FJAUA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f197.google.com ([209.85.161.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUJ3A7GRAPRB5XC43AAKGQEV4FJAUA@isocpp.org>)
	id 1c1rpE-0000sf-8j
	for gclcip-std-proposals@m.gmane.org; Wed, 02 Nov 2016 10:27:16 +0100
Original-Received: by mail-yw0-f197.google.com with SMTP id w82sf14476787ywd.6
        for <gclcip-std-proposals@m.gmane.org>; Wed, 02 Nov 2016 02:27:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=Y/eDcIR6Yk1vaMHMt6iTOB/JJASeVNNisvZA9m4Tius=;
        b=oSX4RLUucGY/uSDOSZGr9SZChRl71lXl296L/O5LFEzUTkyI/r2KTgYE0/fh+5AJlA
         GQm/2oIS8AAu/aawXVqPi+N4W7N6mzTXih4nFRIaihF7rQOm43wItcH9rHhfecETvpTk
         0AL5lXRqQG6K+bJl/XAnJ/MymCwag7LtOGXTDg0Zh/m4BQV4JN2gO/yrnPWdGXtlI6gR
         IFN9FIUzr+mHS2QPYw67BF7tfWXXLMlHyGnjwUkfxdBxBWyVzTfYYVMoOnGIx4tPrGBb
         Q+8Nusk3nUCRbPs7bMGxUW6t7nYbslax3WW+ptYv43BeN+1tF1i9Qp9ciHNwOqVAFT2c
         wZvA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=Y/eDcIR6Yk1vaMHMt6iTOB/JJASeVNNisvZA9m4Tius=;
        b=mahrqhaBRP/Qgc8+JSWZwJcv6sBvMoTCsDct/HspLotkop7Ju6ouTXAalMBmbJ1Som
         yDwEYV2oHt0s2tY7eCv+MYtquodOMXGEr5rWpXZgXb0k3Ai2TI0y3jJn20cfn8cp5KFa
         oq1qcXrrnLji8G3unr7fMPHRSPXfKkz2Rc7Hr7wzvem336Oe1zNqLnkXN1JV2oeIpXA+
         JGg5VnLAUA/9ZCqFSkie6XYju5ERj3R++502+otK9khKSRV1P0aXquxPD5RNddb7lXdh
         n0tK80gtIH5jNkHGtmq3CF4I8hY7RGidUV5h2U3Xlii8U7O2IjNRhfzKlHmeFEMUxxpg
         vYDw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=Y/eDcIR6Yk1vaMHMt6iTOB/JJASeVNNisvZA9m4Tius=;
        b=N5QDKsV2YYspZ5ab/7BMzsUCoBpka++ZdIxDUddkq9woLq3qFK+Wg38vNXD2DLoV4B
         96CpD5utYUjlTK2NAoezwNC81HrRRifyEcYcJEYmoEjECRSRPpBn5UyMzxCyMBjSwix7
         9V1+IVqL7P/75w3HbX5+YoASvNZOVPMeKp3mAz1YIChm5Se3sIAq/WosGDsIggsxeUw2
         sCYpR/MP3yaaE+iRiXUJuWBFYT2xDumORlQXkbsjZVoKJWYtarxF7r7vVxPgGRvAtLOJ
         n2vXnLo1Evf99JYejh56Mu0Y12I5Pb57mNP0z0HvH/TRyNKkTVja95ix2gCSrc+GpJNg
         2p1w==
X-Gm-Message-State: ABUngvf+cWh5g6y/a+4/84GXZzWfYl8iPZAYpmkziQHjqC/BQ+1kIr8RxsyQRkQjwidLEA==
X-Received: by 10.129.129.196 with SMTP id r187mr704037ywf.58.1478078838965;
        Wed, 02 Nov 2016 02:27:18 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.61.97 with SMTP id a88ls3966745otc.41.gmail; Wed, 02 Nov
 2016 02:27:17 -0700 (PDT)
X-Received: by 10.157.15.143 with SMTP id d15mr103743otd.2.1478078837781;
        Wed, 02 Nov 2016 02:27:17 -0700 (PDT)
In-Reply-To: <2128372.NTAZafObDQ@tjmaciei-mobl1>
X-Original-Sender: MihailNajdenov@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:29338
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29338>

------=_Part_1661_2064418561.1478078837367
Content-Type: multipart/alternative; 
	boundary="----=_Part_1662_2067262189.1478078837367"

------=_Part_1662_2067262189.1478078837367
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



On Wednesday, November 2, 2016 at 8:43:35 AM UTC+2, Thiago Macieira wrote:
>
> Em ter=C3=A7a-feira, 1 de novembro de 2016, =C3=A0s 22:16:32 PDT, Nicol B=
olas=20
> escreveu:=20
> > On Wednesday, November 2, 2016 at 12:55:46 AM UTC-4, Thiago Macieira=20
> wrote:=20
> > > That would also not be a good idea because, unsigned char is, by=20
> > > defintion, a=20
> > > byte. Why should we have (more) types that mean exactly the same=20
> thing,=20
> > > and=20
> > > this time in all platforms, by definition?=20
> >=20
> > Because "unsigned char" *also* means "unsigned character". With just=20
> > `unsigned char`, there is no way to distinguish between manipulating=20
> bytes=20
> > and manipulating unsigned characters.=20
> >=20
> > That's what `byte` is for, as a type: a way to semantically=20
> differentiate=20
> > between operations on bytes and operations on characters. The types can=
=20
> be=20
> > inter-convertible, numerically speaking, but they don't mean the same=
=20
> thing.=20
>
> I'm sorry, I don't agree that there's a distinction in the first place.=
=20
> Bytes=20
> are used more often than just copying around. If you add, subtract, shift=
=20
> left=20
> or right, perform bitwise operations, etc, you need the value. If I need=
=20
> the=20
> value, then a zero is a zero is a zero, a 0x40 is still a 0x40.=20
>
> ...
> But while that may be true, what's the point of an *unsigned* char? If yo=
u=20
> want to do character operations, you use char. If you're using unsigned=
=20
> char,=20
> that's because you want a byte, plain and simple. By this argument, we=20
> already=20
> have the distinction between character operations and byte operations.=20
>
> --=20
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org=20
>    Software Architect - Intel Open Source Technology Center=20
>

All byte is trying to do is to make "unsigned char" officially different=20
then char. Better name, better name, no conversions and limited operations.
Also it *does* define bitwise ops.=20
As for arithmetics, well It seems a bit odd indeed, but lets not=20
forget that char is too small on the one hand, and, on the other, unsigned=
=20
is not considered a good type for math (as per '16 cppcon talk).

The idea is to be pure storage format not representing values (strings or=
=20
math) without a cast.=20

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/68625755-8e0d-4030-afd5-d081371f7295%40isocpp.or=
g.

------=_Part_1662_2067262189.1478078837367
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, November 2, 2016 at 8:43:35 AM UTC+2=
, Thiago Macieira wrote:<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Em ter=
=C3=A7a-feira, 1 de novembro de 2016, =C3=A0s 22:16:32 PDT, Nicol Bolas esc=
reveu:
<br>&gt; On Wednesday, November 2, 2016 at 12:55:46 AM UTC-4, Thiago Maciei=
ra wrote:
<br>&gt; &gt; That would also not be a good idea because, unsigned char is,=
 by
<br>&gt; &gt; defintion, a
<br>&gt; &gt; byte. Why should we have (more) types that mean exactly the s=
ame thing,
<br>&gt; &gt; and
<br>&gt; &gt; this time in all platforms, by definition?
<br>&gt;=20
<br>&gt; Because &quot;unsigned char&quot; *also* means &quot;unsigned char=
acter&quot;. With just
<br>&gt; `unsigned char`, there is no way to distinguish between manipulati=
ng bytes
<br>&gt; and manipulating unsigned characters.
<br>&gt;=20
<br>&gt; That&#39;s what `byte` is for, as a type: a way to semantically di=
fferentiate
<br>&gt; between operations on bytes and operations on characters. The type=
s can be
<br>&gt; inter-convertible, numerically speaking, but they don&#39;t mean t=
he same thing.
<br>
<br>I&#39;m sorry, I don&#39;t agree that there&#39;s a distinction in the =
first place. Bytes=20
<br>are used more often than just copying around. If you add, subtract, shi=
ft left=20
<br>or right, perform bitwise operations, etc, you need the value. If I nee=
d the=20
<br>value, then a zero is a zero is a zero, a 0x40 is still a 0x40.
<br>
<br>...<br>But while that may be true, what&#39;s the point of an *unsigned=
* char? If you=20
<br>want to do character operations, you use char. If you&#39;re using unsi=
gned char,=20
<br>that&#39;s because you want a byte, plain and simple. By this argument,=
 we already=20
<br>have the distinction between character operations and byte operations.
<br>
<br>--=20
<br>Thiago Macieira - thiago (AT) <a onmousedown=3D"this.href=3D&#39;http:/=
/www.google.com/url?q\x3dhttp%3A%2F%2Fmacieira.info\x26sa\x3dD\x26sntz\x3d1=
\x26usg\x3dAFQjCNEswDUBNCNanbu7euhqLn_62FW8ag&#39;;return true;" onclick=3D=
"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmacieira.info=
\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEswDUBNCNanbu7euhqLn_62FW8ag&#39;;=
return true;" href=3D"http://macieira.info" target=3D"_blank" rel=3D"nofoll=
ow">macieira.info</a> - thiago (AT) <a onmousedown=3D"this.href=3D&#39;http=
://www.google.com/url?q\x3dhttp%3A%2F%2Fkde.org\x26sa\x3dD\x26sntz\x3d1\x26=
usg\x3dAFQjCNHGRJdo5_JYG1DowztwAHAKs80XSA&#39;;return true;" onclick=3D"thi=
s.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fkde.org\x26sa\x3d=
D\x26sntz\x3d1\x26usg\x3dAFQjCNHGRJdo5_JYG1DowztwAHAKs80XSA&#39;;return tru=
e;" href=3D"http://kde.org" target=3D"_blank" rel=3D"nofollow">kde.org</a>
<br>=C2=A0 =C2=A0Software Architect - Intel Open Source Technology Center
<br></blockquote><div><br></div><div>All byte is trying to do is to make &q=
uot;unsigned char&quot; officially different then char. Better name, better=
 name, no conversions and limited operations.</div><div>Also it <i>does</i>=
 define bitwise ops. </div><div>As for arithmetics, well It seems a bit odd=
 indeed, but lets not forget=C2=A0that char is too small on the one hand, a=
nd, on the other,=C2=A0unsigned is not considered=C2=A0a good type for math=
 (as per &#39;16 cppcon talk).</div><div><br></div><div>The idea is to be p=
ure storage=C2=A0format not representing values=C2=A0(strings or math) with=
out a cast. </div><div><br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/68625755-8e0d-4030-afd5-d081371f7295%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/68625755-8e0d-4030-afd5-d081371f7295=
%40isocpp.org</a>.<br />

------=_Part_1662_2067262189.1478078837367--

------=_Part_1661_2064418561.1478078837367--

.
