3 ms·
That's not what he is saying. He is saying that there is an overhead in term of string length. Example: a string with 0 character has a length of 1 (it contain
by Fradow 11y ago
That's not what he is saying. He is saying that there is an overhead in term of string length.
Example: a string with 0 character has a length of 1 (it contains NULL), a 100% overhead. A string with 1 character has a length of 2, a 50% overhead. It gets better with larger strings.
- eru 11y agoI am saying the same thing. Strings that can't make use of 0 have to be a small constant factor longer to store the same entropy, because each byte can only store log_2 (255) ~ 7.994 bits, instead of log_2 (256) = 8 bits. Of course, if you are storing printable ascii characters only, that doesn't matter, since you are using far less than 256 possibilities per byte, and so don't care that some of them unused onces are used for in-band signalling (https://en.wikipedia.org/wiki/In-band_signaling https://en.wikipedia.org/wiki/In-band_signaling). As vardump points out in another comment, that's equivalent to 1 in 177 bytes. (See also https://en.wikipedia.org/wiki/Control_character https://en.wikipedia.org/wiki/Control_character)