Following the "what's the best use for C" question.
The Linux kernel seems to be a famous and very well thought of C program. But is it a good example of mainstream "best-practice" C?
I'm prepared to get dinged for this, but the Linux kernel is a student project that got out of hand. More seriously, what the Linux kernel does well from a programming point of view is lay down a very rigid set of design and coding guidelines that make it possible for a very large number of people to contribute while still having everything fit together.
People I trust who have made operating systems their life's work tell me that the BSD kernel is a much better example of good C programming and good OS design. I know enough of the professors at Berkeley that I'm not surprised by this claim.
More broadly, OS kernels are highly specialized things---there's nothing mainstream about a kernel. If you want examples of good C practice you might try Kernighan and Pike's book on The Practice of Programming. Or if you want to study a real system, the implementation of Lua is small enough that you can read it all, extremely well engineered, and incredibly portable---runs on any platform with an ANSI C compiler.
Apologies for the subjective and argumentative reply :(
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With