aiusepsi t1_je4u9v5 wrote
Reply to comment by RelativeApricot1782 in ELI5: If digital data is stored in 0s & 1s, how does the reader know how many of the digits to take into consideration? by distinct_oversight
A computer doesn't, but software is (at least for now) written by human beings. You could have the size of the actual payload be implicit, and calculated from the information you've already seen, but there's more opportunity for the person writing the code which is reading the file to get the calculation wrong in some subtle way.
If the size is written explicitly just before the data, you can make the code which reads it much simpler and therefore more reliable. Simple and reliable is really good for this kind of code; mistakes can lead to software containing security vulnerabilities. Nobody wants to get a virus because they played a .wav file!
Viewing a single comment thread. View all comments