ysu to General Programming Discussion · 2 years agoI wrote a simple lines of code counter in Cgit.sr.htexternal-linkmessage-square3fedilinkarrow-up14arrow-down12
arrow-up12arrow-down1external-linkI wrote a simple lines of code counter in Cgit.sr.htysu to General Programming Discussion · 2 years agomessage-square3fedilink
minus-squarettmrichterlinkfedilinkarrow-up2arrow-down2·2 years agofor (size_t i = 0; i < 100; i++) calculate_something_and_display(i); How many lines of code does your system show for this? for (size_t i = 0; i < 100; i++) { calculate_something_and_display(i); } How many lines of code does it show for this? for (size_t i = 0; i < 100; i++) { calculate_something_and_display(i); } What about this? for (size_t i = 0; i < 100; i++) calculate_something_and_display(i); And this? These are all identical in any meaningful way. The compiler’s parser will see them all as exactly the same sequence of tokens with no difference. And now you can understand perhaps why cloc’s complexity isn’t entirely “unnecessary”…
minus-squareysuOPlinkfedilinkarrow-up4·2 years agoActually my program gives the exact same result as cloc for all of those.
minus-squarettmrichterlinkfedilinkarrow-up3arrow-down1·2 years agoAh. Then cloc’s output is apparently meaningless too. Pity. I thought it would at least be recognizing statement count. :-/
for (size_t i = 0; i < 100; i++) calculate_something_and_display(i);
How many lines of code does your system show for this?
for (size_t i = 0; i < 100; i++) { calculate_something_and_display(i); }
How many lines of code does it show for this?
for (size_t i = 0; i < 100; i++) { calculate_something_and_display(i); }
What about this?
for (size_t i = 0; i < 100; i++) calculate_something_and_display(i);
And this?
These are all identical in any meaningful way. The compiler’s parser will see them all as exactly the same sequence of tokens with no difference.
And now you can understand perhaps why cloc’s complexity isn’t entirely “unnecessary”…
Actually my program gives the exact same result as cloc for all of those.
Ah. Then cloc’s output is apparently meaningless too. Pity. I thought it would at least be recognizing statement count. :-/