C/C++ Source Code Counter Program
---------------------
Program Features


What This Program Counts

The retiSoft Source Line of Code (SLOC) Counter program supports two generally accepted practices for counting SLOC:

  1. "Semicolon Counts": Many structured programming languages, such as C/C++, Java, Pascal, and Ada, terminate logical statements with a semicolon. It is fairly common practice in the software industry to parse a source code file for the number of semicolons encountered and to use it as the measure of program size.

    The retiSoft SLOC Counter program counts statement terminating semicolons to provide a logical statement count. The program specifically excludes from this count:

  2. Counting Framework Elements: The retiSoft Source Line of Code (SLOC) Counter program supports user defined application of SEI SLOC counting framework. The types of code lines counted include:


    As mentioned above, comments are an essential element of good programming practices. In fact, a commonly used measure of software quality is the ratio of comments to the counted SLOC. Although I am not aware of any standards for this, I have observed ratios of 1:3 to 1:2 (i.e., one comment for every 2 to 3 SLOC) being accepted as representing a well commented program that promotes its maintainability. The C++ Comment Lines described above refer to only physical lines that contain only a C++ style comment (i.e., one that begins with "//"). In addition to this category, the retiSoft SLOC Counter program also provides counts for other types of comments.

The following illustrates the format used by the retiSoft SLOC Counter program to report the data described above.


        =======================================
        Source File:
          Path:     <path to subject file>
          Filename: <filename>
          These data collected on: <date>

         Semicolon Count:                 <count>
         Physical LOC (by category):      
          Total Lines:                    <count>
          Completely Blank Lines:         <count>
          Compiler Directive Lines:       <count>
          Lines with only C++ Comments:   <count>
          Declaration & Executable Lines: <count>
         Additional Comments Data:        
          Lines with C++ Comments too:    <count>
          Total C++ Comments:             <count>
          C-Style Comments:               <count>
        =======================================

The retiSoft Source Line of Code (SLOC) Counter program also provides an option to output the gathered data at one file per line to a comma-delimited text file that can be imported to a common spreadsheet program, such as Microsoft Excel, for further analysis or charting. The included help file provides specific instructions for importing such a comma-delimited file into the provided Microsoft Excel "template" file.

 


C/C++ Source Code Counter Program Change History

Version Release Date Description
1.1.1 17 July 2001 Initial release.


...return to the retiSoft Products page back

retiSoft inc. is a member of the Association of Shareware Professionals (ASP). ASP wants to make sure that the shareware principle works for you. If you are unable to resolve a shareware-related problem with an ASP member by contacting the member directly, ASP may be able to help. The ASP Ombudsman can help you resolve a dispute or technical problem with an ASP member, but does not provide technical support for members' products. Please contact the ASP Ombudsman online at http://www.asp-shareware.com/omb.