Re: "Using plain integer as NULL pointer" false positive for zero struct initializer

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

 



On Wed, Jan 09, 2019 at 03:14:10PM -0800, Linus Torvalds wrote:
> On Wed, Jan 9, 2019 at 1:02 PM Luc Van Oostenryck
> <luc.vanoostenryck@xxxxxxxxx> wrote:
> >
> > But this make me wonder ...
> > I'm all for strict typing, it's in general a precious help, but
> > for this "Using plain integer as NULL pointer" warning:
> > 1) the problem of using 0 (an int) in a variadic function call
> >    expecting a pointer (possibly larger than an int) is well known
> >    but is there any other problem of using 0 instead of NULL?
> > 2) when the warning is issued it is known that a pointer is expected
> >    so a size problem like in 1) is not possible.
> >
> > So isn't this a case of a 'bad warning'?
> 
> No.

...
 
> Any language which allows you to write
> 
>     strnlen(0, NULL);
> 
> without screaming about getting the types entirely wrong for both
> arguments is simply not worth using.

Yes, of course. I overlooked the obvious case.

-- Luc



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux