Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: comp.lang.c Subject: Re: Requests for nominations of Great C Code (Was Re: Texts ... Message-ID: <1500@mcgill-vision.UUCP> Date: 14 Apr 89 10:59:22 GMT References: <354@cbnewsc.ATT.COM> <433@algor2.UUCP> <942@atanasoff.cs.iastate.edu> <1115@muffin.cme.nbs.gov> Organization: McGill University, Montreal Lines: 37 In article <1115@muffin.cme.nbs.gov>, libes@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@larry.mcrcim.mcgill.edu