Re:Poul-Henning Kamp: The Most Expensive One-byte Mistake
by wladimir on Thursday April 26, 2012 @05:06AM
(#3893032)
Unix is not all-terrible though. It also has quite a few very sane ideas such as combining simple commands into pipelines and "everything is a file descriptor".
I do agree that zero-terminated strings are the worst idea ever. It's almost impossible to use them in a secure and performant way (at the least it requires a lot of extra thinking). Alternative string libraries such as bstring make string handling in C sane, but unfortunately the default C strings mean a lot of people still use char* and str(l)cpy/str(l)cat/strlen/...
The worst thing is that many are religiously convinced that it is a good idea just because it's the UNIX and C way (TM). It's so deeply ingrained.
I do agree that zero-terminated strings are the worst idea ever. It's almost impossible to use them in a secure and performant way (at the least it requires a lot of extra thinking). Alternative string libraries such as bstring make string handling in C sane, but unfortunately the default C strings mean a lot of people still use char* and str(l)cpy/str(l)cat/strlen/...
The worst thing is that many are religiously convinced that it is a good idea just because it's the UNIX and C way (TM). It's so deeply ingrained.