Live data from Hacker News

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

open-std.org

111–120 of 357 posts

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

#111
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?"

C++17 removed trigraphs

Which was quite controversial. Imagine that.

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

#112

D made a great leap forward with the following: 1. bytes are 8 bits 2. shorts are 16 bits 3. ints are 32 bits 4. longs are 64 bits 5. arithmetic is 2's complement 6. IEEE floating point and a big chunk of wasted time trying to abstract these away and getting it wrong anyway was saved. Millions of people cried out in relief! Oh, and Unicode was the character set. Not EBCDIC, RADIX-50, etc.

Yeah, this is something Java got right as well. It got "unsigned" wrong, but it got standardizing primitive bits correct byte = 8 bits short = 16 int = 32 long = 64 float = 32 bit IEEE double = 64 bit IEEE

Yep. Pity about getting chars / string encoding wrong though. (Java chars are 16 bits).

But it’s not alone in that mistake. All the languages invented in that era made the same mistake. (C#, JavaScript, etc).

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

#114
post #89
post #15

During an internship in 1986 I wrote C code for a machine with 10-bit bytes, the BBN C/70. It was a horrible experience, and the existence of the machine in the first place was due to a cosmic accident of the negative kind.

I've worked on a machine with 9-bit bytes (and 81-bit instructions) and others with 6-bit ones - nether has a C compiler

I think the pdp-10 could have 9 bit bytes, depending on decisions you made in the compiler. I notice it's hard to Google information about this though. People say lots of confusing, conflicting things. When I google pdp-10 byte size it says a c++ compiler chose to represent char as 36 bits.

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

#115
post #98

Hmm, I wonder if any modern languages can work on computers that use trits instead of bits. https://en.wikipedia.org/wiki/Ternary_computer

Possible, but likely slow. There's nothing in the "C abstract machine" that mandates specific hardware. But, the bitshift is only a fast operation when you have bits. Similarly with bitwise boolean operations.

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

#117
post #45

Why? Pls no. We've been told (in school!) that byte is byte. Its only sometimes 8bits long (ok, most of the time these days). Do not destroy the last bits of fun. Is network order little endian too?

Heretic, do not defile the last remnants of true order!

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

#118
post #76
post #34

Earlier quoted context omitted.

Henceforth, it follows that a doublesnack is called a lunch. And a quadruplesnack a fourthmeal.

There's only one right answer: Nybble - 4 bits Byte - 8 bits Snyack - 16 bits Lyunch - 32 bits Dynner - 64 bits

And what about elevensies?

(Ok,. I guess there's a difference between bits and hob-bits)

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

#119
post #80

Earlier quoted context omitted.

Maybe specifying that floats are always IEEE floats should be next? Though that would obsolete this Linux kernel classic so maybe not. https://github.com/torvalds/linux/blob/master/include/math-e...

That line is actually from a famous Dilbert cartoon. I found this snapshot of it, though it's not on the real Dilbert site: https://www.reddit.com/r/linux/comments/73in9/computer_holy_...

[flagged]

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

#120

Earlier quoted context omitted.

Yeah, this is something Java got right as well. It got "unsigned" wrong, but it got standardizing primitive bits correct byte = 8 bits short = 16 int = 32 long = 64 float = 32 bit IEEE double = 64 bit IEEE

I like the Rust approach more: usize/isize are the native integer types, and with every other numeric type, you have to mention the size explicitly. On the C++ side, I sometimes use an alias that contains the word "short" for 32-bit integers. When I use them, I'm explicitly assuming that the numbers are small enough to fit in a smaller than usual integer type, and that it's critical enough to performance that the ass…

hindsight has its advantages
Post reply on HN