George
George

Reputation: 7317

Counting the number of functions and data structures in a C codebase

Is there a way to take a C file (or a directory/project) and count the number of functions + data structures? This is similar to counting the LOC but instead is focused on counting the number of "conceptual units" the program handles as a way to measure its complexity.

Upvotes: 1

Views: 219

Answers (2)

ryyker
ryyker

Reputation: 23208

It sounds like you are in need of perusing your source code. Doxygen is an excellent tool for summarizing just about every aspect of a C project. (and many other languages). It is OpenSource, and easily downloaded. Additionally, the list of features is extensive.

Upvotes: 1

abelenky
abelenky

Reputation: 64682

On a Linux environment, you'll want to look at a tool like objdump, that will show you a bunch of information about the compiled output.

There are pages that explain some of its complicated output, such as this. But perhaps one of the simplest is objdump -T.

Upvotes: 0

Related Questions