Quality programming in c -- a rarity?
Geoff Kuenning
geoff at desint.UUCP
Thu Feb 7 05:32:56 AEST 1985
>In other words, if those who write Unix utilities, surely the
>top level of C hackers, routinely write bad code -- maybe some sort
>of restrictions in the language are necessary to help people?
There is an unfortunate assumption here, and that is that the Unix utilities
were written by a bunch of superprogrammers who were C experts. But in fact,
the utilities show a wild variation in the abilities of their authors. Some
of the code is indeed superb, but most of it is an example of how to write
unreadable C. This is entirely to be expected. Bell Labs is a research
organization; most people were not especially interested in writing the most
maintainable code possible. Many utilities were written by someone who
needed them to get a bigger job done; frequently that person did not take
the time to coordinate their design decisions with the people down the hall
(cf. join, cut, paste, sort, grep, uniq, and comm). Others were written as
an exercise in learning C, or by people who were not full-time professional
programmers.
It is possible to write bad code in any language. C is perhaps more
conducive to this than other languages, and perhaps could stand improvement
in this area. But please don't use the Unix sources as an example of what
really well-written C can look like. Contrast the recently-posted
public-domain terminfo sources for a look at what a conscientious programmer
produced.
--
Geoff Kuenning
Unix Consultant
...!ihnp4!trwrb!desint!geoff
More information about the Comp.lang.c
mailing list