Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

(terminating strings with '\0'? yeah, great choice)

Why? What would have been better?

The only alternative I know about is saving the size of the string, but that comes with its own little set of problems.



How about something like a C++ strings? C strings are great for memory-constrained platforms, like computers were back in the day, or small embedded computers now. On a modern computer though, it doesn't make sense. The amount of security problems that C strings cause is unbelievable. So using something different to C strings would hopefully reduce the amount of buffer overflow exploits (you would still have unchecked array bounds though, but they would be less accessible without C strings).

Of course, something like C++ strings might need more processing to do basic things, but between the OS latency/overhead, I/O times and human perception, you wouldn't notice any difference at all.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: