TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"W. Wesley Groleau x4923" <[log in to unmask]>
Reply To:
W. Wesley Groleau x4923
Tue, 12 Oct 1999 11:25:36 -0500
text/plain (31 lines)
> > > Does anyone know of a web/ftp site with a good SLOC counter for Ada?
> >
> > yes, the Unix command:                       :-)
> >
> > wc -l *.ad*
>         Well, this only counts input lines, not necessarily code lines.  Of
> course, one line of readable code may span several input lines.
>         This has always been one of the debates on counting lines of code --
> just what is a line?  ...

If one is not already out there (online), I am willing to provide Ada
source for a semicolon counter that is smart enough to ignore them in
comments, string literals, and character literals.

> just what is a line.  On our project, we count semi-colons.  Thus a
> nested statement counts as one line.  Our coding standards allow nesting
> at up to three levels of depth.  Also, since conditional statements do
> not end with semi-colons, any logic doesn't count.

And, BTW, a conditional DOES have a semicolon.  In any branching
construct, you have one semicolon for every statement inside, plus one (on
the 'end') for the construct itself.

Also, counting semicolons counts declarations, including parameter
declarations, and record fields (except it misses one for each set of
parameters).  I think this is good, because if you are doing good
engineering, you should be spending at least as much effort on one
variable or parameter as you do on one executable statement.