News for hackers. Stuff that matters.
Re:How could the early Unix OS comprise so few lines of code? by jhoechtl on Monday September 11, 2023 @05:28AM (#37464783)
They also did't care that much about

* unit testing

* framework boiler plate

* testing pragmas

* mockups

Re:How could the early Unix OS comprise so few lines of code? by Conlectus on Monday September 11, 2023 @06:44AM (#37465330)
If you’ve read any of the code you’ll also know that early Unix was full of security vulnerabilities. Eg. Statically allocating fixed buffers and not checking input sizes.

I’m all for appreciating simplicity, but let’s not pretend we haven’t progressed since then.

Re:How could the early Unix OS comprise so few lines of code? by Joker_vD on Monday September 11, 2023 @08:41AM (#37466363)
Not only early Unix; look at the original inet_addr implementation [0]. It accepts not only "0x" but also just "x" as the 16-base prefix, it doesn't really care about the numbers overflowing, and it parses 09 as equal to 011 (which is decimal 9). And the less said about the coding style, the better.

[0] https://github.com/dank101/4.2BSD/blob/master/lib/libc/inet/...

Re:How could the early Unix OS comprise so few lines of code? by cogman10 on Monday September 11, 2023 @12:14PM (#37469442)
There were also a lot of practical limitations on the hardware that need to be recognized. These weren't devices that could store megabytes of data for code or memory. Not only that, but the compilers were also a lot dumber (by necessity). So, optimizations you'd normally leave up to the compiler (like inlining) you instead did by hand.
Re:How could the early Unix OS comprise so few lines of code? by jandrese on Monday September 11, 2023 @02:36PM (#37471613)
This part is frequently lost on people. Bell labs developed a multi-user operating system that supported multiple people logged in at the same time on a machine with 64 kilowords (144kB) of storage.

Later development was done on a machine that supported a max of 4MB of memory and had to allow for hundreds of simultaneous logins. Keeping the code compact was a high priority, even over usability in some cases.

Re:How could the early Unix OS comprise so few lines of code? by tleb_ on Monday September 11, 2023 @08:31AM (#37466252)
Unit testing doesn't account for many lines in the Linux kernel. I see 33 test suites.

    $ find include/kunit/ -type f | xargs wc -l --total=only
    2418
    $ git grep -lE '^kunit_test_suites\(' | xargs wc -l --total=only
    17838