by ryanobjc · 13y ago · 0 comments
On the flip side, I wonder how people deal with 'programming in the large' with C - other than 'just be really really careful'
I whole-heartedly agree. Something that blew my mind back in undergraduate school was tree.h by Niels Provos, [1] which is a complete key/value-type agnostic Red-black Tree [2] in a single header file. Just recently when re-learning C I stumbled upon klib [3] which has a similar take on generic programming by "abusing" the preprocessor.
If I am allowed to side-track, I found "C The Hard Way" to be a good resource when re-learning C. I also had a lot of fun with "Expert C Programming", although it is a bit dated. I highly recommend it once you have a grasp of the language basics. I have heard good things about "21st Century C", but I am still wondering what other good resources there are out there.
[1]: http://svnweb.freebsd.org/base/head/sys/sys/tree.h?view=mark...
In similar spirit, the linked list variant: http://cgit.osmocom.org/libosmocore/tree/include/osmocom/cor..., though the macros in sys/queue.h are also useful for linked lists.