C strings suck!

utzoo!decvax!decwrl!sun!megatest!fortune!hpda!hplabs!hao!seismo!rocheste!ritcv!mjl utzoo!decvax!decwrl!sun!megatest!fortune!hpda!hplabs!hao!seismo!rocheste!ritcv!mjl
Thu May 5 09:59:38 AEST 1983

In refererence to Tim Maroney's complaints about C strings, in particular his
suggestion that strings be made a primitive type in the language: while we're
at it, why not add built-in I/O statements?  And, since the VAX has some nice
polynomial evaluation instructions, why not make polynomials a primitive as
well?  And I'm certain there are some engineers and scientists out there who
curse C because it doesn't directly support complex arithmetic.

All of this, of course, leads to a proliferation of language "features," and
soon we'd have C looking like PL/I (heaven forbid!!).  The sparseness of C,
coupled with its flexibility, is one of the strong points in the language.  C
certainly has its share of warts, but simply adding stuff on top without very
careful consideration of the consequences can lead up with something much
worse.  At the minimum, any significant change should be first evaluated using
a preprocessor that generates "real" C, so that there is a low cost prototype
available for experimentation.

As for the VAX string instructions, they can be accessed via assembly language
routines if that's important to you.  We've done this for the C string
library, and the net performance improvement was almost nil for the majority
of programs (not because of the overhead of the function call, but because the
string routines just don't contribute much to the overall execution time).

Mike Lutz

More information about the Comp.lang.c mailing list