Requests for nominations of Great C Code (Was Re: Texts ...

der Mouse mouse at mcgill-vision.UUCP
Fri Apr 14 20:59:22 AEST 1989


In article <1115 at muffin.cme.nbs.gov>, libes at cme.nbs.gov (Don Libes) writes:
[the >>> lines are someone else; I forget who]
>>> I am very interested in the answers others have to the following:
>>> What ts the best C code you have ever read?

Very hard question.  I've seen so little good code, and I remember the
bad code for longer.  On thought, I'm not sure I've seen any really
good code on the size scale you're looking for (and that includes my
own code, too :-).

> I'd like to cast both positive and negative votes for Gosling's
> emacs.  And who could forget display.c?  I have reproduced the
> beginning of it here for your amusement.

> [skull-and-crossbones comment from display.c.  Following words have
> been reformatted to save lines.  Orignal was much prettier.]

> All ye who enter here:  Most of the code in this module is twisted
> beyond belief!  Tread carefully.  If you think you understand it,
> 			      You Don't,
> 			    So Look Again.

He wasn't kidding, either.  I once tried to rewrite it preparatory to,
I think, making the cost formulas conform more closely to reality for
the Sun console (where, for example, insert and delete operations have
high overhead and slightly *negative* per-count cost).  All I succeeded
in doing was slowing it down by about a factor of four, and introducing
some bugs to boot.

I ended up retrofitting the new cost formulas into the old code, and
fudging to pretend that insert/delete operations were purely overhead.
Someday when I have a spare month or two, perhaps....

					der Mouse

			old: mcgill-vision!mouse
			new: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.lang.c mailing list