how many lines in your program?

Started by
21 comments, last by AndreTheGiant 20 years, 8 months ago
I frequently hear people talking about writing 1000 lines of code for this project or 10 000 lines for that. First of all, 1000 lines isnt that much is it? I could be wrong, but isnt that just a couple of functions, in maybe 2 or 3 source files? Anyway, Im using vc++ and i have about 30 files in my current project (15 header and 15 cpp approx). Is there an easy way to get vc++ to count all the lines in my project so i know how many lines i wrote? Also, when people say 1000 lines of code, does that include whitespace and really trivial code? Does it include comments? for example,


#include <iostream.h>
#include <fstream>

using namespace std;

int main ( )
{

  // create a read/write file-stream object on tiny char

  // and attach it to the file "filebuf.out"

  ofstream out("filebuf.dat",ios_base::in |ios_base::out);
this is technically 12 lines, but there is only really 1 line of ''actual'' code if you ask me. Would this count as 12, or 1 or something else? If vc++ has a counting functionality, does it cound this as 12 or 1 or something else? thanks!
Advertisement
I'd count it as 5...

edit: but as for how people usually count their programs, I usually round down a bit. for instance....

~/Projects/timbirc/src$ cat * | wc -l   4016 


I've got a small two thousand line project...


[edited by - C-Junkie on August 9, 2003 4:23:18 PM]
I don''t believe there is an official standard about this since it''s not a very useful way to measure code but I''d simply count all lines including comments, whitespaces and preprocessor definitions.
'ROIDRAGE!!! - I wanna work for the chinese communist regime!
Why would you not count "trivial code"?

In my experience, without that "trivial code" your program wouldn''t work
http://www.wndtabs.com/ provides a nice little line counting plugin for visual studio 6/7.

Jan Rehders / sheijk. Velox3D programmer at 6S
Token count would be much more interesting than line count.
int main() { cout << "hello world" << endl; } 

12 tokens
int main(){cout << "hello world" << endl;} 

12 tokens
token count numbers would be huge for any project

[edited by - psykr on August 10, 2003 5:40:42 PM]
Does it really matter? My current project is about 25000 lines at the moment, woohoo, yay for me... *sighs*. It''s the quality of code you write not the quantity.

Death of one is a tragedy, death of a million is just a statistic.
If at first you don't succeed, redefine success.
No python you fail to realize that you NEED to know the number of lines in your project! What else would you put in your sig besides esoteric metal lyrics?
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis
quote:Original post by python_regious
Does it really matter? My current project is about 25000 lines at the moment, woohoo, yay for me... *sighs*. It''s the quality of code you write not the quantity.


Agreed. That said, I probably would count comments. Comments are an important part of writing code.

This topic is closed to new replies.

Advertisement