Re: [dev] semicolons

From: Roger <>
Date: Fri, 18 Nov 2011 02:41:00 -0900

> On Fri, Nov 18, 2011 at 11:40:10AM +0100, pancake wrote:
>I've checked and noticed that they are calculating the
>of their vm in semicolons instead of number of lines.
>I think this is a much simpler way to calculate the complexity of a
>program and can be
>implemented easily with awk.
>using sloccount is probably cool, but sloccount is far from perfect, as
>long as can be
>tricked by using different indentations.
>This is why I'm considering other ways to calculate code complexity. And
>semicolons or parenthesys can be a good way to do it.
>What do you think?
>$ cat dwm.c | sed -e 's,;,ROFL\n,g' |grep ROFL |wc -l
>Doing it in C would be even simpler, and we can distribute it as the
>standard suckless
>tool for calculating code complexity in C programs.
>Counting opened parenthesis is also a nice way to check complexity.. so
>my idea is to
>write a tool like 'wc', but showing statistical info from source programs.
>- skip comments, quoted chars ("strings", ';') and #if0'd code
>- count lines
>- count parenthesis
>- count semicolons

Statistically speaking, it might be best at this point to use a multitude of
counting mechanisms, using both line counts and semicolon counts.

Anything can be worked around one way or another. For reference, standard
benchmark tools also never look at just "one thing".

Received on Fri Nov 18 2011 - 12:41:00 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 18 2011 - 12:48:04 CET