3 ms·
Ask HN: Examples of beautiful C code?
Hey, HN,
I hardly ever read other people's code, but I'd like to start dedicating a few hours each week to studying idiomatic C. The ultimate goal is to improve my own code.
What are some codebases that are worth studying? Bonus points for open-source projects that are looking for new contributors.
- apaprocki 15y agoSince it was just posted, the xv6 ANSI C Unix source is nice and fairly compact. They even provide a nice PDF for you to take it with you: http://pdos.csail.mit.edu/6.828/2011/xv6/xv6-rev6.pdf http://pdos.csail.mit.edu/6.828/2011/xv6/xv6-rev6.pdf Also the low-level GLib core library is good: http://git.gnome.org/browse/glib/tree/glib http://git.gnome.org/browse/glib/tree/glib
- herbivore 15y agoYou should check out Redis - https://github.com/antirez/redis https://github.com/antirez/redis
- deutronium 15y agoYou might be interested in http://www.amazon.com/Beautiful-Code-Leading-Programmers-Practice/dp/0596510047 http://www.amazon.com/Beautiful-Code-Leading-Programmers-Pra... I believe one of the examples they gave in C was the diff algorithm from Subversion.
- naner 15y agothe netbsd kernel.
- davyjones 15y ago* Postgresql * Varnish
- infamouscow 15y agoThe Quake 3 source code - https://github.com/xxpor/Quake https://github.com/xxpor/Quake
- slig 15y ago* SQLite
- ivysummer 15y agolinux kernel code is good enough for c examples.
- tjholowaychuk 15y agoI'm certainly not the best C programmer out there but hey, might want to have a look at: - https://github.com/visionmedia/luna https://github.com/visionmedia/luna - https://github.com/visionmedia/libcss https://github.com/visionmedia/libcss