bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] non-null declarations


From: Jim Meyering
Subject: Re: [PATCH] non-null declarations
Date: Thu, 10 Dec 2009 15:58:14 +0100

Bruno Haible wrote:
> Here's a proposed patch for introducing some __nonnull__ declarations. For
> a start, I'm focusing on gnulib's replacement files lib/*.in.h, because these
> declare the most often used functions.
>
> I put __nonnull__ declarations
>   1) in places where passing a NULL pointer leads to undefined behaviour,
>   2) in places where POSIX says that the function will always fail when a NULL
>      pointer is passed. (For example: tsearch.)
> glibc uses __nonnull__ declarations only for case 1. But IMO warning also in
> case 2 will be more good than bad.

Good!  Thanks for doing all that work.

> Two points I'm not sure about:
>   - Should the macro be called _GL_ARG_NONNULL or GL_ARG_NONNULL?
>   - Is it worth putting the macro definition (always the same 10 lines of 
> code)
>     into a separate file, like done with link-warning.h?

I lean towards _GL_ARG_NONNULL, for slightly less risk of impact
on application name space.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]