Topic: Introduction of a new keyword/fundamental


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Thu, 31 Dec 2015 21:45:45 +0300
Raw View
On 2015-12-31 21:23, Bo Persson wrote:
> On 2015-12-31 16:47, Vincent Reverdy wrote:
>> What do you mean?
>> Do you think that sizeof(byte) should be equal to CHAR_BIT instead of 1?
>> An evident problem would arise for typedefs using bytes as underlying
>> types.
>> I personnally don't want |uint_least8_t|to be equal to CHAR_BIT.
>> But an operator bitcount() could be very useful.
>
>
> How useful is byte when CHAR_BIT is 9, or 16, or 24? And what size would
> it be?

I think you're confusing byte with octet.

--

---
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 email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Thu, 31 Dec 2015 22:42:14 +0300
Raw View
On 2015-12-31 22:13, Robert Ramey wrote:
> On 12/31/15 10:23 AM, Vincent Reverdy wrote:
>> cstdint are typedefs of integral types. So:
>
> Wouldn't the following create all you need right now?
>
> using byte = std::uint8_t;
>
> as for printing, why would assume that a "byte" should be printed as a
> decimal integer.  Why not a hax or octal.

Because that's the default when you output int or long or any other
integral type that is considered a number by the library, as opposed to
a character.

> In any case, you'd be best
> off by creating a couple of io manipulators named things like:
>
> hex(?), octal(?), etc which can be used for all integer types.  They
> probably already exist anyway.

They do exist as std::hex, std::oct and std::dec. That doesn't help with
char-based types though.

--

---
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 email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Fri, 1 Jan 2016 14:38:19 +0300
Raw View
On 2016-01-01 13:59, Bo Persson wrote:
> On 2015-12-31 19:45, Andrey Semashev wrote:
>> On 2015-12-31 21:23, Bo Persson wrote:
>>> On 2015-12-31 16:47, Vincent Reverdy wrote:
>>>> What do you mean?
>>>> Do you think that sizeof(byte) should be equal to CHAR_BIT instead
>>>> of 1?
>>>> An evident problem would arise for typedefs using bytes as underlying
>>>> types.
>>>> I personnally don't want |uint_least8_t|to be equal to CHAR_BIT.
>>>> But an operator bitcount() could be very useful.
>>>
>>>
>>> How useful is byte when CHAR_BIT is 9, or 16, or 24? And what size would
>>> it be?
>>
>> I think you're confusing byte with octet.
>
> Yes, I am, and I believe most people will assume that.
>
> Therefore I think it would be extremely confusing to introduce a type
> 'byte' that is an octet on most systems, but not guaranteed to be that
> on all.

Most people assume bool and char are 8-bit, short is 16-bit and int is
32-bit, while all of it are false assumptions. People's misconceptions
should not guide the language evolution.

--

---
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 email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Andrey Semashev <andrey.semashev@gmail.com>
Date: Fri, 1 Jan 2016 18:55:47 +0300
Raw View
On 2016-01-01 18:47, Bo Persson wrote:
> On 2016-01-01 12:38, Andrey Semashev wrote:
>> On 2016-01-01 13:59, Bo Persson wrote:
>>> On 2015-12-31 19:45, Andrey Semashev wrote:
>>>>
>>>> I think you're confusing byte with octet.
>>>
>>> Yes, I am, and I believe most people will assume that.
>>>
>>> Therefore I think it would be extremely confusing to introduce a type
>>> 'byte' that is an octet on most systems, but not guaranteed to be that
>>> on all.
>>
>> Most people assume bool and char are 8-bit, short is 16-bit and int is
>> 32-bit, while all of it are false assumptions. People's misconceptions
>> should not guide the language evolution.
>
> I still don't see that adding more possible misconceptions is a great
> idea either.

I don't think that using the term 'byte' in accordance with its
definition is adding any misconceptions.

> Perhaps if you call it something else than byte. Like raw_memory, or
> something?

The proposed type doesn't fit the raw_memory name.

--

---
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 email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-proposals/.

.