Deutsch   English   Français   Italiano  
<vtqtth$f45$2@reader1.panix.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.os.vms
Subject: Re: Clair Grant on VMS code base
Date: Thu, 17 Apr 2025 12:58:26 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <vtqtth$f45$2@reader1.panix.com>
References: <vsh5m5$3is6e$1@dont-email.me> <67fee5b8$0$708$14726298@news.sunsite.dk> <vtplin$9us$2@reader1.panix.com> <vtqslm$j0ll$1@dont-email.me>
Injection-Date: Thu, 17 Apr 2025 12:58:26 -0000 (UTC)
Injection-Info: reader1.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
	logging-data="15493"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)

In article <vtqslm$j0ll$1@dont-email.me>,
Arne Vajhøj  <arne@vajhoej.dk> wrote:
>On 4/16/2025 9:29 PM, Dan Cross wrote:
>> In article <67fee5b8$0$708$14726298@news.sunsite.dk>,
>> Arne Vajhøj  <arne@vajhoej.dk> wrote:
>>> There is no question that it is most accurate to only
>>> count the continued line as one in your example.
>>>
>>> But I suspect that a lot of LOC counters just count
>>> non-blank and non-comment.
>>>
>>> Anything else requires language knowledge.
>>>
>>> And while it for Fortran, Basic, Macro-32 may be relative
>>> simple, then for other languages it can become more tricky.
>>>
>>> Let us take 4 times Pascal:
>>>
>>> if a = 1 then b := 2 else b := 3;
>>>
>>> if a = 1 then
>>>     b := 2
>>> else
>>>     b := 3;
>>>
>>> if a = 1 then begin
>>>     b := 2;
>>> end else begin
>>>     b := 3;
>>> end;
>>>
>>> if a = 1 then
>>> begin
>>>     b := 2;
>>> end
>>> else
>>> begin
>>>     b := 3;
>>> end;
>>>
>>> How many lines? I would say that the most correct is 3 in
>>> all 4 cases. But coding the line counter to return that
>>> would require it to have Pascal knowledge.
>>>
>>> And what about the fluent style that are so modern?
>>>
>>> o = f.create();
>>> o.add(1);
>>> o.add(2);
>>> o.add(3);
>>>
>>> o = f.create()
>>>       .add(1)
>>>       .add(2)
>>>       .add(3);
>>>
>>> o = f.create().add(1).add(2).add(3);
>>>
>>> 1 1 1 or 4 1 1 or 4 4 1 or 4 4 4??
>>>
>>> So I think counters go for the simple approach and assume
>>> that for large code bases with many developers then total
>>> converge towards an "average" style.
>> 
>> Most modern code-counting tools _are_ language aware.  Whether
>> they do a better or worse job for each given language may be a
>> matter of debate, but most at least recognize different
>> languages and have some knowledge of their semantics.
>> 
>> Cf, https://github.com/XAMPPRocky/tokei?tab=readme-ov-file
>> https://github.com/AlDanial/cloc?tab=readme-ov-file#recognized-languages-
>> https://github.com/boyter/scc/blob/master/LANGUAGES.md
>> 
>> etc.
>
>Their language awareness consist of recognizing comments.
>
>They are examples of some of those tools that simply count
>non-blank non-comment lines.
>
>(SCC also know some keywords but that is used for complexity
>calculation not for line counting)
>
>C:\Work>type demo.c
>// C demo
>
>#include <stdio.h>
>
>int main()
>{
>     int a[] = {
>         1,
>         2,
>         3
>     };
>     printf("%d %d %d\n",
>         a[0],
>         a[1],
>         a[2]);
>     return 0;
>}
>
>C:\Work>cloc-1.96 demo.c
>        1 text file.
>        1 unique file.
>        0 files ignored.
>
>github.com/AlDanial/cloc v 1.96  T=0.01 s (67.5 files/s, 1147.0 lines/s)
>-------------------------------------------------------------------------------
>Language                     files          blank        comment 
>   code
>-------------------------------------------------------------------------------
>C                                1              2              1 
>     14
>-------------------------------------------------------------------------------
>
>C:\Work>scc demo.c
>───────────────────────────────────────────────────────────────────────────────
>Language                 Files     Lines   Blanks  Comments     Code 
>Complexity
>───────────────────────────────────────────────────────────────────────────────
>C                            1        17        2         1       14 
>      0
>───────────────────────────────────────────────────────────────────────────────
>Total                        1        17        2         1       14 
>      0
>───────────────────────────────────────────────────────────────────────────────
>Estimated Cost to Develop (organic) $305
>Estimated Schedule Effort (organic) 0.63 months
>Estimated People Required (organic) 0.04
>───────────────────────────────────────────────────────────────────────────────
>Processed 200 bytes, 0.000 megabytes (SI)
>───────────────────────────────────────────────────────────────────────────────
>
>C:\Work>tokei-x86_64-pc-windows-msvc demo.c
>===============================================================================
>  Language            Files        Lines         Code     Comments 
>Blanks
>===============================================================================
>  C                       1           17           14            1 
>      2
>===============================================================================
>  Total                   1           17           14            1 
>      2
>===============================================================================

You are aware that there are other tools, correct?  These are
just examples of a handful that have _some_ language awareness.

	- Dan C.