4 ms·
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 cl
by powerbook5300CS 5y ago
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.
- thorin 5y agoI 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.
- dkarl 5y agoI 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.
- atonse 5y agothis probably correlates to why there is such a rich ecosystem of pg extensions and forks.
- spacemanmatt 5y agowhile true, the architecture rather than code hygiene deserves credit for facilitating the ecosystem of extensions and forks. in my husky opinion.
- datavirtue 5y agoAlso explains how Pivotal was able to refactor it into a MPP (Greenplum).
- jjice 5y agoPostgres'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.
- bear8642 5y agoThe Plan 9 operating system is good C codebase to explore too
- zvr 5y agoIf 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.
- efrecon 5y agoI came here to say this. Redis and SQLite, mentioned elsewhere, have their roots in Tcl, so there are some connections.
- erdeibit 5y agoAgree and not only Redis, the way Salvatore Sanfilippo (Redis creator) program is very readable and instructive. A glance into its repos worth the time.
- warmwaffles 5y agosqlite too. It's good.