News for hackers. Stuff that matters.
Re:Git's list of banned C functions by bobbyi_settv on Thursday March 04, 2021 @06:11PM (#26349831)
It doesn't just buy safety. It also makes it possible to include null bytes inside of strings.
Re:Git's list of banned C functions by kortex on Thursday March 04, 2021 @08:30PM (#26351249)
This is the part that boggles my mind. It's not like fat pointers just didn't exist at the time. You need fat pointers any time you do anything with dynamic non-string binary data.

Null is always 1 byte minimum so at best you save size_t-1 bytes per string. Ignoring clever structures like LEB128 varint length.

This is a classic case of "simple is actually complex". How many billions of dollars has null terminal strings cost? Hope that 3 bytes of overhead per string saved is worth it.

Re:Git's list of banned C functions by NavinF on Thursday March 04, 2021 @06:26PM (#26349980)
and with length+array you don't need 2 copies of so many functions (array input vs string input)

No matter how you slice it, null termination was a mistake.