You copied the Doc URL to your clipboard.

Arm Compiler armclang Reference Guide : __attribute__((nonnull)) function attribute

__attribute__((nonnull)) function attribute

This function attribute specifies function parameters that are not supposed to be null pointers. This enables the compiler to generate a warning on encountering such a parameter.

Syntax

__attribute__((nonnull[(arg-index, ...)]))

Where [(arg-index, ...)] denotes an optional argument index list.

If no argument index list is specified, all pointer arguments are marked as nonnull.

Note

The argument index list is 1-based, rather than 0-based.

Examples

The following declarations are equivalent:

void * my_memcpy (void *dest, const void *src, size_t len) __attribute__((nonnull (1, 2)));
void * my_memcpy (void *dest, const void *src, size_t len) __attribute__((nonnull));
Was this page helpful? Yes No