[lkml]   [2012]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] staging: comedi: serial2002: quiet NULL pointer sparse noise
On 2012/06/08 07:51 AM, Dan Carpenter wrote:
> On Fri, Jun 08, 2012 at 07:46:19AM +0100, Ian Abbott wrote:
>> On 08/06/12 01:14, H Hartley Sweeten wrote:
>>> Quiet a number of sparse warnings in this file:
>>> warning: Using plain integer as NULL pointer
>> I wonder why sparse warns about that for a literal, unadorned 0? I
>> suppose NULL is more explicit, but a plain 0 means the same as NULL
>> in a pointer context (unlike a zero from some random expression).

Thanks for the link. I understand the intent to make null pointer
constants easier to recognize. Still, the text of the sparse warning
message "Using plain integer as NULL pointer" is technically incorrect
since 0 is not an integer (plain or otherwise) in a pointer context,
it's a null pointer constant.

I wonder if it also issues that warning for a struct initializer such as
{0} where the first member of the struct is a pointer, or would it
expect you to use {NULL} which is more confusing when the struct
contains a mixture of pointer and non-pointer members?

-=( Ian Abbott @ MEV Ltd. E-mail: <> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-

 \ /
  Last update: 2012-06-08 11:41    [W:0.045 / U:7.340 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site