Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Dave Froble Newsgroups: comp.os.vms Subject: Re: Clair Grant on VMS code base Date: Thu, 17 Apr 2025 21:28:38 -0400 Organization: A noiseless patient Spider Lines: 162 Message-ID: References: <67fee5b8$0$708$14726298@news.sunsite.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 18 Apr 2025 03:28:56 +0200 (CEST) Injection-Info: dont-email.me; posting-host="965b5c453c59ebb170c1fe231b9d752f"; logging-data="1984907"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/qbTHZmuj3K4ZgN+7clzSJZZtFtAjmHow=" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:/Coc7bq71z0kwL4mCUvoL0IbqlY= In-Reply-To: Bytes: 10003 On 4/17/2025 8:58 AM, Dan Cross wrote: > In article , > Arne Vajhøj wrote: >> On 4/16/2025 9:29 PM, Dan Cross wrote: >>> In article <67fee5b8$0$708$14726298@news.sunsite.dk>, >>> Arne Vajhøj 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 >> >> 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. > I don't know compilers, but, I'd think a compiler might have the best idea of the statements, output code, and such. Perhaps they just aren't set up to tell us? -- David Froble Tel: 724-529-0450 Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com DFE Ultralights, Inc. 170 Grimplin Road Vanderbilt, PA 15486