# less_retarded_wiki

main page, file list (652), source, commit RSS feed, report abuse, stats, random article, consoomer version

# Lines of Code

Lines of code (LOC, KLOC = 10K LOC, MLOC = 1M LOC etc., also SLOC = source LOC) is a metric of software complexity that simply counts the number of lines of program's source code. It is by no means a flawless measure but despite some soyboys shitting on it it's actually pretty good, especially when using only one language (C) with consistent formatting style. However it must also be used well -- here are the main caveats:

- Logarithmic scale should be used, i.e. rather than exact line count we should sort into categories such as: under 10 LOC, under 100 LOC, under 1000 LOC and so on.
- When you use it as a productivity measure at work, you're guaranteed your slave peasants are gonna just shit out as much meaningless code as possible in which case the measure crumbles under a spectacular fountain of code diarrhea and fails again. Here also the logarithmic scale doesn't make much sense, so basically using it as a performance measure just sucks. Fortunately, at LRS we don't have such problems :)
- Of course it also becomes shitty when you have a project in 20 programming languages written by 100 pajeets out of which every one formats code differently. This we also do not practice.

Of course it may also be necessary to define what a "line of code" means exactly. Usually we distinguish raw lines (every single one) and logical lines (only those that "matter", may exclude comments and empty lines). Does a long line with a line break count as a single line or two? Do we include line count of libraries we use? What if instead of lines we rather measured source code file size? Or programming language token count? Just make sure you know what you're measuring and why.

A comfy tool for counting lines is `cloc`, but you can also just use `wc -l` to count raw lines.

Here are (sometimes very) approximate line counts for some programs written (mainly) in C, in ascending order: hello world (~5), brainfuck interpreter (~50), Fairy-Max chess (~1000), raycastlib (~2000), dwm (~2500), SAF (~5000), Anarch (~15000), tcc (~25000), Lua (~30000), Doom (~35000), Quake (~100000), Pokemon Emerald (~500000), OpenBSD (~10000000), Linux (~30000000), Windows XP (~40000000).

Powered by nothing. All content available under CC0 1.0 (public domain). Send comments and corrections to drummyfish at disroot dot org.