Zero terminated "strings"

String copy is like 5 lines of code to write yourself, you want to add on a bunch of big num shit to make it 100.

You think file formats don't use null termination literally everywhere?

Its really fucking easy, you just mmap it into memory and start reading. The OS will load and unload the pages for you.

People wasting space at the high level is no excuse to waste shit at the low level. Even worse wasting space at the low level is going to make all that high level shit even shittier.

Yes.

Then you aren't using any null termination.

You're free to null terminate your own esoteric string use cases if you really need to squeeze the fuck out of every byte of memory, but the chances that you do are probably 0. I don't think you understand how meaningless those 3 bytes really are in this case.

combining that with the other text, it's pretty much obvious that he doesn't.

mmap is not dependent on the file type you dolt

No reason to optimize! Not like computers process hundreds of billions of strings a day! That would not be beneficial at all!

which retarded file format are you using which has zero termination at the end?

Null-terminated strings have the advantage of behaving extremely well with recursive function, as constructing a suffix substring is just a matter of incrementing a pointer.
Think about how Lisp handles list: they are chained cons cells, with the last cons having an empty (null) list as its CDR. This is how you work with recursivity in Lisp.
The fact that you think null-terminated strings are useless prove you have still much to learn, youngling.


Wrong. First of all, a size_t variable in a 64 bits environment is 64 bits, so we're talking about 7 extra byes. Second of all, those bytes are nothing on a text, but when you have a plethora of max 10 characters strings (quite frequent), with 32 bits system it increases their size by a 30% factor, on 64 bits system, it's 70% of memory usage increase.
Imagine storing an associative array that uses, as keys, 5-char strings with 8 byte size variable. That's 13 bytes per key. With null-terminated strings, it's 6 bytes. That's some 118% more space used by the size+string solution.

The absolute state of C idiots in this board, everyone.

Go back to your javascript bullshit. Clearly you don't care about efficiency and interchangeability.

Do you know that EOF is an integer value, not an unsigned char, that most strings in a system are very small, that strlen() is rarely needed, and that you can still store a string's length in C, while not losing the advantages of the NULL termination?