←back to thread

182 points Twirrim | 2 comments | | HN request time: 0.643s | source
Show context
kreco ◴[] No.41874966[source]
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

replies(2): >>41874974 #>>41876119 #
bobmcnamara ◴[] No.41874974[source]
I, for one, hate that int8 == signed char.

std::cout << (int8_t)32 << std::endl; //should print 32 dang it

replies(1): >>41875004 #
1. kreco ◴[] No.41875004[source]
Now 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.
replies(1): >>41875133 #
2. PaulDavisThe1st ◴[] No.41875133[source]
Very enjoyable. It will a constant reminder that I need to decide how I want std::byte to print - character or integer ...