Q:

Reading/Understanding third-party code

When you get a third-party library (c, c++), open-source (LGPL say), that does not have good documentation, what is the best way to go about understanding it to be able to integrate into your application?
The library usually has some example programs and I end up walking through the code using gdb. Any other suggestions/best-practicies?
For an example, I just picked one from sourceforge.net, but it's just a broad engineering/programming question:
http://sourceforge.net/projects/aftp/

A:

I frequently use a couple of tools to help me with this:

GNU Global.  It generates cross-referencing databases and can produce hyperlinked HTML from source code.  Clicking function calls will take you to their definitions, and you can see lists of all references to a function.  Only works for C and perhaps C++.
Doxygen.  It generates documentation from Javadoc-style comments.  If you tell it to generate documentation for undocumented methods, it will give you nice summaries.  It can also produce hyperlinked source code listings (and can link into the listings provided by htags).

These two tools, along with just reading code in Emacs and doing some searches with recursive grep, are how I do most of my source reverse-engineering.

