WANTED: "C" code line counter program

Craig P McLaughlin cpm00 at duts.ccc.amdahl.com
Wed Mar 13 02:36:41 AEST 1991


In article <1991Mar11.182848.26693 at comm.wang.com> lws at comm.wang.com (Lyle Seaman) writes:
>dcavasso at ntpal.uucp (Dana Cavasso) writes:
>>     I need a "C" code line counter program, preferably written in
>>"C".  It will be used on several platforms, so solutions involving
>
>Counting semi-colons is a pretty good approach, as that counts C 
>statements.  Lines is kind of less meaningful.  Counting '{' is 
>an interesting one, too.
>

  Counting semi-colons may miscount setups like the one below:

    while(condition)
        do_this;

  That's two, I think. :)  What about counting newlines, but ignoring those
that immediately follow another newline (ie, skip blank lines)?

Craig McLaughlin   cpm00 at duts.ccc.amdahl.com   V:(408)737-5502
   I think it's time to come up with a witty signature and disclaimer...



More information about the Comp.lang.c mailing list