Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!haven!mimsy!tove.cs.umd.edu!cml From: cml@tove.cs.umd.edu (Christopher Lott) Newsgroups: comp.software-eng Subject: Re: WANTED: "C" code line counter program Message-ID: <31331@mimsy.umd.edu> Date: 12 Mar 91 17:29:21 GMT References: <1991Mar6.214157.18633@ntpal.uucp> <1991Mar11.182848.26693@comm.wang.com> <2969@inews.intel.com> <1142@caslon.cs.arizona.edu> Sender: news@mimsy.umd.edu Reply-To: cml@tove.cs.umd.edu (Christopher Lott) Organization: The University of Maryland Dept of Computer Science Lines: 36 In article <1142@caslon.cs.arizona.edu> dave@cs.arizona.edu (Dave P. Schaumann) writes: >So what we really need is to define what we mean by "# of statements" by >setting up some rules like > o declaration/assignment/function call is 1 statement > o rules for counting constructs like if/while/for > a good idea might just count the # of statements it groups, so > if( foo ) S would have the same statement count as S (perhaps +1) > o a rule for do S while() - perhaps the same as above, but you may > want to treat this seperately. > o { S } has the same statement count as S > o rules for macros, comments, function headers, etc. First off, remember that SLOC is not a good metric for answering hard questions like productivity. It's a great measure of size, though, and cheap to compute. Define your SLOC carefully - but I recommend that you contact the IEEE and get their standards document on this (sorry, don't have the ref). Anyone? Then apply your definition carefully to projects in your environment - but don't even try to compare your numbers to those from another environment until you and your fellow SLOC-counter have discussed how you defined SLOC. For example, someone has quoted numbers from Japanese software companies. I am told that these folks usually report their numbers in assembler-equivalent lines - what size they believe their program would be in assembler. This is ok, I guess, if you have an assembler available beneath your compiler (like C) but who knows what they did for other environments? Good luck. A tool to do what you desire will be straightforward to build. Lessee, are you offering consultant rates? I might be interested :-) :-) chris... -- Christopher Lott \/ Dept of Comp Sci, Univ of Maryland, College Park, MD 20742 cml@cs.umd.edu /\ 4122 AV Williams Bldg 301.405.2721