This is a good codebase to browse if you’re interested in high-quality C. The style was heavily influenced by the way C code is written in djb’s codebases.
Also interesting are the handful of core data structures they defined (eg. stuffer) and use pervasively, high ratio of tests to code, and multiple proof engines.
This is a good codebase to browse if you’re interested in high-quality C. The style was heavily influenced by the way C code is written in djb’s codebases.
In particular, notice how a small set of macros were made to do common checks, defer, etc https://github.com/awslabs/s2n/blob/master/utils/s2n_safety.h
And how this leads to extremely legible code with minimal branching and appropriate error checks/cleanup https://github.com/awslabs/s2n/blob/2f9ce2965ecd1f77f2c18ab51096a302fe833f7e/tls/s2n_tls13_certificate_verify.c#L73
Also interesting are the handful of core data structures they defined (eg. stuffer) and use pervasively, high ratio of tests to code, and multiple proof engines.