Counting lines of code

smallB picture smallB · Jul 4, 2012 · Viewed 17.4k times · Source

I was doing some research on line counters for C++ projects and I'm very interested in algorithms they use. Does anyone know where can I look at some implementation of such algorithms?

Answer

stelonix picture stelonix · Jul 4, 2012

There's cloc, which is a free open-source source lines of code counter. It has support for many languages, including C++. I personally use it to get the line count of my projects.

At its sourceforge page you can find the perl source code for download.