Background
I am currently working for a quite large (relative to what I have done before) hobby project. I would like to compare the size of this project to other open-sourced projects but I cannot figure out how I should do that in a good and meaningful way.
Problems with using line count
I usually see project size being measured in line of code.
I do not consider that to be a good way to measure code size because then projects that have code that is styled like this:
int function(int argument_one, int argument_two) {
int var1, var2, var3;
code;
code;
if (test(var2, var3))
code;
else
code;
return var1;
}
will appear about 40 % smaller than projects with code that is styled like this:
int function(int argument_one, int argument_two)
{
int var1;
int var2;
int var3;
code;
code;
if (test(var2, var3))
{
code;
}
else
{
code;
}
return var1;
}
Other ways
Some other ways I have heard of are:
Character count
Comment count
Word count
Compilation time
But all of these has disadvantages. Comment count would make messy code with lots of comments appear longer. Compilation time is dependent on how fast the computer is and how the code is compiled. Word and character count are also highly dependent on how the code is styled.
Question
I am wondering if there are any more reliable ways to measure project size than the ones listed here.
What are more reliable ways to measure code size? Has there been attempts to come up with a universal way to measure code size? Are there any tools available that measures code size in a more meaningful way than simply counting lines/words/chars?