Some sad remarks about string handling in C
Paul W. Abrahams · ACM SIGPLAN Notices · 1988
Many people have criticized the C programming language for its failure to enforce discipline in programming. They cite the lack of typechecking and the locutions that expose and indeed emphasize the underlying machine model. C is less often criticized for lack of efficiency. Yet in a critical part of the language -- string handling -- the efficiency of C falls short of the mark.String handling is a major application of C. In the original C book by Kernighan and Ritchie, nearly every example has something to do with strings. In systems programming, another major application, string handling is a large part of the task. If a skillful C programmer cannot easily write programs that manipulate strings efficiently, then the language has failed to meet one of its central goals.There are two problems with strings in C. The first is the use of a representation for strings in which a terminating null character indicates the length of the string. The second is the lack of built-in operations on strings analogous to the ones provided for arithmetic data.