Can anyone recommend an intermediate to advanced C book? I feel like most C material I've been exposed to in the past lacks what a modern C project should have when it comes to best practices, code organization, build tools (should I use make for this, cmake, where does autotools fit? what about clang vs gcc?), linters (valgrind?), testing, etc. I recognize that much of this falls outside of C, but all of these tools seem like things C projects routinely grapple with.
I recommend (by most expensive, to free):<p>Marshall Kirk McKusick's FreeBSD Intensive Code Walkthrough: <a href="https://www.mckusick.com/courses/advdescrip.html" rel="nofollow">https://www.mckusick.com/courses/advdescrip.html</a><p>Also, <i>The Design and Implementation of the FreeBSD Operating System (2nd Edition)</i>: <a href="https://www.amazon.com/Design-Implementation-FreeBSD-Operating-System/dp/0321968972" rel="nofollow">https://www.amazon.com/Design-Implementation-FreeBSD-Operati...</a><p>Thirdly: grab a copy of FreeBSD (or OpenBSD) and (a) set it up in VirtualBox and SSH it into locally (b) use an old ThinkPad. Then grab the source code of the base system. Build and install it. And start reading code of things like usr.bin/grep/grep.c
This book is not about OS dev but rather systems programming: "The Linux Programming Interface", <a href="https://nostarch.com/tlpi" rel="nofollow">https://nostarch.com/tlpi</a><p>For OS development resources, this wiki is very good: <a href="http://wiki.osdev.org" rel="nofollow">http://wiki.osdev.org</a>
<a href="http://pages.cs.wisc.edu/~remzi/OSTEP/" rel="nofollow">http://pages.cs.wisc.edu/~remzi/OSTEP/</a> is really good and approachable. It was even recommended in one of the Gatech OS courses.
To learn which traps to avoid in C, have a look at SEI CERT C. It's written very well with examples and explanations, and is structured as a coding guide.<p><a href="https://wiki.sei.cmu.edu/confluence/display/c/SEI+CERT+C+Coding+Standard" rel="nofollow">https://wiki.sei.cmu.edu/confluence/display/c/SEI+CERT+C+Cod...</a>
I recently decided to review operating systems, but my old Tanenbaum textbook from college would take forever to read through especially now that I'm working full time. I've been watching the Berkeley lecture series on Youtube (CS 162) and its been pretty good at covering the main topics concisely.
I personally found the best method of brushing up on C and operating systems was just walking through examples myself...<p>Haven't personally done it for a few years, but I went through step by step on my blog (particularly in 2014):<p><a href="https://austingwalters.com/knowledge/" rel="nofollow">https://austingwalters.com/knowledge/</a><p>I also have a nice repo of a bunch of IPC examples:<p><a href="https://github.com/lettergram/IPC-examples" rel="nofollow">https://github.com/lettergram/IPC-examples</a>
Knowing and fully understanding the concept of undefined behaviour (UB) and the difference to unspecified and implementation-defined behaviour is a must for safe and secure C programming. Because arguably, C and C++ are broken at the specification level. Chris Lattner puts this in kind words:<p><a href="http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_14.html" rel="nofollow">http://blog.llvm.org/2011/05/what-every-c-programmer-should-...</a>
Somewhat unrelated but I've always wanted ask: What types of small projects can a beginner start to develop a better understanding of C ? (Beyond basic syntax, something that would actually make use of memory allocation, pointers etc)
I like this little book, in very small amount of space it teaches you how to build a bare bones OS, from there you can start doing your own experiments which I think is the best way to really learn something:<p><a href="https://littleosbook.github.io/" rel="nofollow">https://littleosbook.github.io/</a><p>It's good to not only know operating systems in general, but also to understand some of the internals of the operating system you are actually using. For Linux, this is good:<p><a href="https://0xax.gitbooks.io/linux-insides/content/index.html" rel="nofollow">https://0xax.gitbooks.io/linux-insides/content/index.html</a>
CS50 courses (This is CS50!), cs50.io is currently one of the easiest and the best introduction to C language. It's very modern approach to teaching C programming.
Will recommending my own project get me hell-voted? Cixl is a straight forward 3-stage (parse/compile/eval) interpreter that is designed to be as fast as possible without compromising on simplicity, transparency and flexibility. The codebase has no external dependencies and is currently hovering around 7 kloc including tests and standard library. There are some articles explaining design decisions, but I've been mostly busy with code. The code should be perfectly readable though, and contains plenty of good ideas distilled from 32 years of daily practice.<p><a href="https://github.com/basic-gongfu/cixl" rel="nofollow">https://github.com/basic-gongfu/cixl</a><p><a href="https://github.com/basic-gongfu/cixl/tree/master/devlog" rel="nofollow">https://github.com/basic-gongfu/cixl/tree/master/devlog</a>