Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!ontek!mikey From: mikey@ontek.com (michael "krill-man" lee) Newsgroups: comp.lang.c Subject: Re: Count lines of source code Message-ID: <1781@ontek.com> Date: 22 Feb 91 19:14:04 GMT References: <1991Feb21.204522.1195@bellcore.bellcore.com> Organization: Ontek Corporation -- Laguna Hills, California Lines: 29 In comp.lang.c,comp.sources.wanted, snk@bae.bellcore.com (Samuel N Kamens) writes: | | Hi, | | Does anybody have or know of a routine that will count the | actual statements in a file of C source code? I want to | eliminate comments, and compress multi-line statements | to register as a single statement. grep '[;}]' | wc -l I would stress that using any sort of line counter as a measure of programmer productivity is likely to backfire. If anything, there is an advantage in maintainability for a program which is more compact. Fewer source lines often result in smaller object files, which in turn taxes memory resources to a lesser degree. There are a number of metrics one can apply to source: lines per function ratio of source / object ratio of comments / source characters per line All are meaningless. Compile the code and see if it works. As you might have guessed, this subject is one of my pet C peeves. the krill, poorly adjusted paragraphs is the other one