Abstract
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.
Index Terms
- Some sad remarks about string handling in C
Recommendations
Shortest string containing all permutations
In this paper, we consider the problem of constructing a shortest string of {1,2,...,n} containing all permutations on n elements as subsequences. For example, the string 1 2 1 3 1 2 1 contains the 6 (=3!) permutations of {1,2,3} and no string with less ...
Some remarks on teaching of programming
CompSysTech '04: Proceedings of the 5th international conference on Computer systems and technologiesIn this paper we give some remarks on the problem of teaching programming for the first year students at the undergraduate level. The remarks are based on the experience gained by the author through several years of teaching programming at the Warsaw ...
Comments