| Reading code is best. Downloading and building the code locally and running it (debugging snags along the way) is a helpful skill. Like this: Ever use tmux? What if the system your building tmux against doesn't have queue.h (found in Free/OpenBSD)? https://github.com/tmux/tmux/blob/master/compat/queue.h How does tmux know to include queue.h? First, the build system detects if the system has the macros declared, https://github.com/tmux/tmux/blob/58e9d12/configure.ac#L481 and defines a C Preprocessor Symbol HAVE_QUEUE_H. That then gets swept up in the build process: https://github.com/tmux/tmux/blob/a3967de/compat.h#L82. Look at queue.h, nice, portable, solid macros for linked lists. It's actually derived from BSD's queue.h decades ago. I like how FreeBSD's fork of queue.h has a table of the macro's features: https://github.com/freebsd/freebsd/blob/releng/11.1/sys/sys/... Here's the linked list for Postgres, https://github.com/postgres/postgres/blob/master/src/include.... Also, check out Postgres lexer and parser utilities: https://github.com/postgres/postgres/blob/master/src/backend... (for Flex) and https://github.com/postgres/postgres/blob/master/src/backend... (for BISON) If you insist on an all-around programming book, Code Complete by Steve McConnell. |