typestar

APIs, errors & testing

11 steps in 4 sets of C.

How to write C that other people can use. Function signatures that say what they mean, opaque pointers for encapsulation, error returns and cleanup paths that do not leak on the third early exit.

Eleven steps on the difference between C that compiles and C that belongs in a library.

Start this tour

Signatures

Encapsulation

Errors & cleanup

Encore

  • Assert-based testsA test is a function full of asserts, called from main. No framework needed.
  • adt_stack.cAn abstract data type done properly: opaque handle, error enum, tests in main.

The other C tours