Myths Open Source Developers Tell Ourselves
Subject:   on code reading
Date:   2003-12-16 13:00:49
From:   theoldmoose
Response to: on code reading

Heh. The quickest I've learned code is to port it to another platform. That will force you to become aquainted with the entire code base in fairly short order. 8-)

And while I was at it, I 'ANSI-fied' a piece of C code (a 400+ function machine vision library) that produced hundreds of warnings when fed to a modern compiler. The original code had virtually no prototypes, except those that were thought to be required for functions whose Miranda prototypes might not match.

Of course, I uncovered several bad assumptions in that code along the way, including unused and incorrect parameter passing. Some of these were causing latent and/or re-occurring mysterious errors that applications programmers had long ago given up finding, and had coded work-arounds to in their code.

That was the initial payoff. Having a much more maintainable piece of code continued to pay off over the 10+ year lifespan of the code as a library. It is still in use in hi-speed wirebonding machines on the Intel Pentium line.

The library was not Open Source in the sense that we use it today, but it was shipped in source form to our machine vision OEM customers, for use by their application programmers. So, it had to be buildable on various embedded 32-bit Unix-like platforms, and useable both within realtime OS environments (like VxWorks) or running on a bare-metal C runtime library.

It was all done with the GNU cross-compiler toolset and CVS, on SunOS workstations. Most fun I remember having in a long time. 8-)