2011-07-23

I'm Back - And It Hurts

Working with strings is painful in C. I knew that.

But I have completely forgotten, how brain-shattering painful it is.

I guess it's common knowledge, but let's recap some of the issues:

And yes, I know that those pitfalls (and many more) are well-documented in the man pages. I know that C strings are of unmatched space efficiency. I know that it was the only possible way to get unlimited strings on machines with a 64k core.

And it's not that it was impossible to work with standard strings in C. It's just much harder than it needs to be. And much more dangerous.

It's like [insert crazy rhetoric figure, comparing working with C strings with [doing normal stuff] using [highly dangerous equipment]].

Or something like that.

PS: Just in case this isn't clear to everyone: C is a programming language. In fact, C is a pretty good programming language. I like it very much. It's a piece of cake to implement better strings in C, custom made for your needs. Only the string implementation of the standard library is, well, a bit unpleasant to use.



comments powered by Disqus