4 ms·
Obviously C-style strings can still remain an option where they are needed, but in most cases using the 4 bytes for a length field is a sane default. How many b
by nwiswell 5y ago
Obviously C-style strings can still remain an option where they are needed, but in most cases using the 4 bytes for a length field is a sane default. How many buffer overflow attacks have been enabled by that four byte savings over the years?
> "Sane" strings that discourage the developer from just coming up with a simple memory management scheme that fits the situation at hand.
"Sane" compilers that discourage the developer from considering the machine level instructions. It's turtles all the way down.
There's a reason that Python is so popular and it's not performance
- jstimpfle 5y agoThis is not Python so that's a strawman.
- nwiswell 5y agoBy that I meant that there is obviously value in abstracting away tasks and details that the programmer would otherwise need to manage. That is why compilers exist. The value-add for abstracting a string is certainly more than the cost of 4 bytes of memory in the typical case. Put another way: optimizing the management of strings in memory is almost never the best use of time to make progress toward an organization's objectives, and doubly so when that kind of micro-tuning can actually introduce security risks