Collin Funk wrote:
> The GCC documentation says [1]:
> 
>     If no arg-index is given to the nonnull attribute, all pointer
>     arguments are marked as non-null.
> 
> It gives an example stating that the following two declarations are
> equivalent:
> 
>     extern void *
>     my_memcpy (void *dest, const void *src, size_t len)
>             __attribute__((nonnull (1, 2)));
>     extern void *
>     my_memcpy (void *dest, const void *src, size_t len)
>             __attribute__((nonnull));
> 
> That said, I can put the argument number if that is your preference.

Yes, that would be my preference. Because we often create the declaration of
a new function by copying the declaration of an existing function and
adjusting it. In this situation, any implicit behaviour is a pitfall.
Better rely on declaring things explicitly.

Bruno




Reply via email to