Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Redis. Read the redis source code if you want to see nice C.

The reason it always impresses me is that C can look like gobledygook, but yet this codebase is clean and understandable.



I was impressed with the Redis codebase too. I think it benefits from being relatively new in C terms so it doesn't have too much baggage (2009, is really new in terms of C projects!). It must also take a lot of discipline on behalf of the maintainer.

I seem to remember Postgres and Sqlite were relatively accessible to a low intermediate C programmer. When I've had to look at Android code (more C++ admittedly) I've started to get lost very quickly.


I second Postgres. Not only is the source code a pleasure to read, there's also an unusual amount of well-presented material about its internals available online.


this probably correlates to why there is such a rich ecosystem of pg extensions and forks.


Also explains how Pivotal was able to refactor it into a MPP (Greenplum).


while true, the architecture rather than code hygiene deserves credit for facilitating the ecosystem of extensions and forks. in my husky opinion.


Postgres's Yacc definition helped me a ton when I was using Yacc. The documentation out there for Yacc/bison isn't great, but Postgres served as a decent set of examples.


If you're looking for code in C, the implementation of Tcl is a wonderful code base. You can even focus on specific parts instead of the complete scripting language: how to create a hash table, for example.


I came here to say this. Redis and SQLite, mentioned elsewhere, have their roots in Tcl, so there are some connections.


Agree and not only Redis, the way Salvatore Sanfilippo (Redis creator) program is very readable and instructive. A glance into its repos worth the time.


The Plan 9 operating system is good C codebase to explore too


sqlite too. It's good.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: