__attribute__
Using
nonnull
encodes expectations about values into an explicit contract, which can help catch anyNULL
pointer bugs lurking in any calling code. Remember: compile-time errors ≫ run-time errors.
Here’s the GCC reference for function attributes and the list of attributes supported by the Clang Static Analyzer.