Viewing a single comment thread. View all comments

theBarneyBus t1_je1unvu wrote

You’re completely correct that it could either be 9 or a 2 then a 1. The issue is that you’re assuming that the is no context.

In storage, there are conventions (e.g. ASCII) that say that basic text is 8 bits per letter. Similarly, other data is stored in fixed-length intervals.
In RAM, whoever is writing to it determines how it is used. It could be any length. The program (and programmer) using it needs to make sure they’re using it correctly.

There are also ways to compress things like text, where bit length is dynamic. But that’s a bit complex, so let me know if you want that explanation as well.

26

aiusepsi t1_je4ogqj wrote

ASCII actually only uses 7 bits per letter, but because the smallest block of bits that a typical computer can individually access is 8 bits, the 8th bit goes unused and is always 0.

Which turned out to be very useful; the extra bit can be used for backwards-compatible extensions to ASCII, like UTF-8, which can represent characters not available in ASCII.

4