On 11/18/2013 10:49 AM, Lukas Slebodnik wrote:
On (16/11/13 09:39), Simo Sorce wrote:
> On Sat, 2013-11-16 at 19:16 +0530, Pallavi Jha wrote:
>> Hello,
>>
>> Please find the attachment below. Kindly review.
>>
> I am not really a fan of these null checks, I prefer the code to crash
> in this case because these functions should never be called with an
> empty context.
>
> Simo.
>
We can make a compromise. extra runtime check will not be added, but we can use
__attribute__(nonnull), but only to functions with extern modifier.
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-g_t_0040...
From my tests this will only catch calls where NULL is passed directly:
my_func(NULL) so it is kinda useless in this code.