8 ms·
I'm totally fine with enforcing that int8_t == char == 8-bits, however I'm not sure about spreading the misconception that a byte is 8-bits. A byte with 8-bits
by kreco 2y ago
I'm totally fine with enforcing that int8_t == char == 8-bits, however I'm not sure about spreading the misconception that a byte is 8-bits. A byte with 8-bits is called an octet.
At the same time, a `byte` is already an "alias" for `char` since C++17 anyway[1].
[1] https://en.cppreference.com/w/cpp/types/byte https://en.cppreference.com/w/cpp/types/byte
- bobmcnamara 2y agoI, for one, hate that int8 == signed char. std::cout << (int8_t)32 << std::endl; //should print 32 dang it
- kreco 2y agoNow you can also enjoy the fact that you can't even compile: std::cout << (std::byte)32 << std::endl; because there is no default operator<< defined.
- PaulDavisThe1st 2y agoVery enjoyable. It will a constant reminder that I need to decide how I want std::byte to print - character or integer ...
- spc476 2y agoMy first experience with computers was 45 years ago, and a "byte" back then was defined as an 8-bit quantity. And in the intervening 45 years, I've never come across a different meaning for "byte". I'll ask for a citation for a definition of "byte" that isn't 8-bits.
- larsbrinkhoff 2y ago1979 is quite recent as computer history goes, and many conventions had settled by then. The Wikipedia article discusses the etymology of "byte" and how the definition evolved from loosely "a group of bits less than a word" to "precisely 8 bits". https://en.wikipedia.org/wiki/Byte https://en.wikipedia.org/wiki/Byte
- kreco 2y agoThat's interesting because maybe a byte will not be 8-bit in 45 years from now on. I'm mostly discussing from the sake of it because I don't really mind as a C/C++ user. We could just use "octet" and call it a day, but now there is an ambiguity with the past definition and potential in the future definition (in which case I hope the term "byte" will just disappear).
- mort96 2y agoNah, a byte is 8 bits. This is a normative statement, not a descriptive statement.
- pests 2y ago> A byte with 8-bits is called an octet The networking RFC's since inception have always used octet as well.