Counting source lines of code

Discussion in 'Computer Science & Culture' started by AntonK, May 21, 2003.

Thread Status:
Not open for further replies.
  1. AntonK Technomage Registered Senior Member

    Messages:
    1,083
    Does anyone here know a good software program to count C or C++ source lines of code? I could very easily write one, but I'm not sure what lines to count since in C and C++ and Java you often have lines wiht a single character on them, such as {
    I seem to remember there being some kind of formula or algorithm on how to compute source lines of code, but I don't remember it now.

    If anyone has the software or knows of one, please link.

    -AntonK
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. LSatyl Registered Senior Member

    Messages:
    44
    Other than wc -l?

    Please Register or Log in to view the hidden image!



    Oops, posted to soon, on edit:

    Take a look here. It's a list of source code counters. I've no idea what's a good one, I've never felt the need to experiment

    Please Register or Log in to view the hidden image!

    .
     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. river-wind Valued Senior Member

    Messages:
    2,671
    unless you are dealing with alot of individual files, you can always open each file in vi, hit shift-g, cntrl-g (I think, or is it cntl-g, shift-g....I've been in Windows too long), and get the line count.

    gets more time consuming than it's worth once you have more than 6 files or so to deal with. gl
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. AntonK Technomage Registered Senior Member

    Messages:
    1,083
    Unfortunately I have approximaty 150 files. Too many to do it manually... plus for counting source lines of code, not all lines count.

    -AntonK
     
  8. CompiledMonkey The Lurker Registered Senior Member

    Messages:
    96
    I'm in the same boat. I've got about 50-60 source files I'd like to count.
     
  9. CuriousGene Supreme Allied Commander Registered Senior Member

    Messages:
    114
    ???

    Aren't single character lines like '}' still considered a line of code? It does for me because without that one character my doesn't work

    Please Register or Log in to view the hidden image!

     
  10. AntonK Technomage Registered Senior Member

    Messages:
    1,083
    You can count it...but i believe there are industry stands for what SLOC (source lines of code) are. And I'm almost sure that a single line with } doesn't count. As it shouldn't since depending on your coding style, you can have that on a line with other code. The standard for SLOC, I believe, takes into consideration the code itself, not how its formatted.

    -AntonK
     
Thread Status:
Not open for further replies.

Share This Page