Live data from Hacker News

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

open-std.org

51–60 of 357 posts

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

#51
post #25

Is C++ capable of deprecating or simplifying anything? Honest question, haven't followed closely. rand() is broken,I;m told unfixable and last I heard still wasn't deprecated. Is this proposal a test? "Can we even drop support for a solution to a problem literally nobody has?"

Signed integers did not have to be 2’s complement, there were 3 valid representations: signed mag, 1s and 2s complement. Modern C and C++ dropped this and mandate 2s complement (“as if” but that distinction is moot here, you can do the same for CHAR_BIT). So there is certainly precedence for this sort of thing.

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

#52

Some people are still dealing with DSPs. https://thephd.dev/conformance-should-mean-something-fputc-a... Me? I just dabble with documenting an unimplemented "50% more bits per byte than the competition!" 12-bit fantasy console of my own invention - replete with inventions such as "UTF-12" - for shits and giggles.

They can just target C++23 or earlier, right? I have a small collection of SHARCs but I am not going to go crying to the committee if they make C++30 (or whatever) not support CHAR_BIT=32

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

#54
post #5

JF Bastien is a legend for this, haha. I would be amazed if there's any even remotely relevant code that deals meaningfully with CHAR_BIT != 8 these days. (... and yes, it's about time.)

Here's a bit of 40 year old code I wrote which originally ran on 36-bit PDP-10 machines, but will work on non-36 bit machines.[1] It's a self-contained piece of code to check passwords for being obvious. This will detect any word in the UNIX dictionary, and most English words, using something that's vaguely like a Bloom filter.

This is so old it predates ANSI C; it's in K&R C. It used to show up on various academic sites. Now it's obsolete enough to have scrolled off Google. I've seen copies of this on various academic sites over the years, but it seems to have finally scrolled off.

I think we can dispense with non 8-bit bytes at this point.

[1] https://animats.com/source/obvious/obvious.c

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

#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 little bit easier?

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

#57
post #25

Is C++ capable of deprecating or simplifying anything? Honest question, haven't followed closely. rand() is broken,I;m told unfixable and last I heard still wasn't deprecated. Is this proposal a test? "Can we even drop support for a solution to a problem literally nobody has?"

well they managed to get two's complement requirement into C++20. there is always hope.

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

#58
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.

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

#59
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 not sure why you think being able to store values from -512 to +511 is more logical than -128 to +127?

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

#60
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 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?
Post reply on HN