[clug] [OT] Null-terminated strings: expensive mistake or not
direvus at gmail.com
Wed Aug 3 23:21:09 MDT 2011
On 4 August 2011 12:41, steve jenkin <sjenkin at canb.auug.org.au> wrote:
> A friend sent me this link making a case that null-terminated strings
> were "The Most Expensive One-byte Mistake".
> I think it was exactly right at the time:
> - fits the Unix Philosophy: simple and definitive solutions
> - falls naturally out of C and how it handles pointers
> Which begs the question:
> Is it right for now?
It was right at the time *for C* and it's still right today *for C*
and for the same reasons. C is still the right fit for some
applications, and the NUL terminated string still makes sense in those
C is an atomic footgun for sure, but I don't think it's got much to do
with the way strings are represented. I think it's because managing
your own memory is Hard to get right.
More information about the linux