Live data from Hacker News

C++ proposal: There are exactly 8 bits in a byte

open-std.org

61–70 of 357 posts

Re: C++ proposal: There are exactly 8 bits in a byte

#61
post #56

So please do excuse my ignorance, but is there a "logic" related reason other than hardware cost limitations ala "8 was cheaper than 10 for the same number of memory addresses" that bytes are 8 bits instead of 10? Genuinely curious, as a high-level dev of twenty years, I don't know why 8 was selected. To my naive eye, It seems like moving to 10 bits per byte would be both logical and make learning the trade just a li…

Eight is a nice power of two.

Can you explain how that's helpful? I'm not being obtuse, I just don't follow

Re: C++ proposal: There are exactly 8 bits in a byte

#63

Earlier quoted context omitted.

It's very useful on hardware that is not an x86 CPU.

As an abstraction on the size of a CPU register, it really turned out to be more confusing than useful.

On RISC machines, it can be very useful to have the concept of "words," because that indicates things about how the computer loads and stores data, as well as the native instruction size. In DSPs and custom hardware, it can indicate the only available datatype.

The land of x86 goes to great pains to eliminate the concept of a word at a silicon cost.

Re: C++ proposal: There are exactly 8 bits in a byte

#64
post #60

Earlier quoted context omitted.

I'm not sure why you think being able to store values from -512 to +511 is more logical than -128 to +127?

Buckets of 10 seem more regular to beings with 10 fingers that can be up or down?

I think 8bits (really 7 bits) was chosen because it holds a value closest to +/- 100. What is regular just depends on how you look at it.

Re: C++ proposal: There are exactly 8 bits in a byte

#65
post #61

Earlier quoted context omitted.

Eight is a nice power of two.

Can you explain how that's helpful? I'm not being obtuse, I just don't follow

It's easier to go from a bit number to (byte, bit) if you don't have to divide by 10.

Re: C++ proposal: There are exactly 8 bits in a byte

#66
post #61

Earlier quoted context omitted.

Eight is a nice power of two.

Can you explain how that's helpful? I'm not being obtuse, I just don't follow

One thought is that it's always a whole number of bits (3) to bit-address within a byte. It's 3.5 bits to bit address a 10 bit byte. Sorta just works out nicer in general to have powers of 2 when working on base 2.

Re: C++ proposal: There are exactly 8 bits in a byte

#68
post #56

So please do excuse my ignorance, but is there a "logic" related reason other than hardware cost limitations ala "8 was cheaper than 10 for the same number of memory addresses" that bytes are 8 bits instead of 10? Genuinely curious, as a high-level dev of twenty years, I don't know why 8 was selected. To my naive eye, It seems like moving to 10 bits per byte would be both logical and make learning the trade just a li…

I'm fairly sure it's because the English character set fits nicely into a byte. 7 bits would have have worked as well, but 7 is a very odd width for something in a binary computer.

Re: C++ proposal: There are exactly 8 bits in a byte

#69

Earlier quoted context omitted.

Doesn't matter ternary computers just have ternary bits, 8 of them ;)

Supposedly, "bit" is short for "binary digit", so we'd need a separate term for "ternary digit", but I don't wanna go there.

The standard term is "trit" because they didn't want to go there.

Re: C++ proposal: There are exactly 8 bits in a byte

#70
post #50

Earlier quoted context omitted.

I, for one, hate that int8 == signed char. std::cout << (int8_t)32 << std::endl; //should print 32 dang it

Now you can also enjoy the fact that you can't even compile: std::cout because there is no default operator<< defined.

Very enjoyable. It will a constant reminder that I need to decide how I want std::byte to print - character or integer ...
Post reply on HN