[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] maint: avoid clang -Wint-to-pointer-cast warning
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] maint: avoid clang -Wint-to-pointer-cast warning |
Date: |
Mon, 14 Jul 2014 14:51:10 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 07/14/2014 01:59 AM, Bob Proulx wrote:
> Pádraig Brady wrote:
>> Subject: Re: [PATCH] maint: avoid clang -Wint-to-pointer-cast warning
>
> What was the text of the original warning? I think that would be
> interesting to review. I think it would provide an additional clue.
It was complaining that !NULL is sizeof(int)
which we're then assigning to a pointer which might
not be the same size, hence the warning.
>> * src/chroot.c: Explicitly cast int to pointer type.
>
>> - g = (struct group *)! NULL;
>> + g = (struct group *) (intptr_t) ! NULL;
So all this is doing is initializing g to a non NULL value.
Not the cleanest code I admit.
> I think instead of either I would rather see a plain boolean that
> explicitly says what it is doing there.
Yes probably cleaner. I was just trying to avoid another variable.
thanks,
Pádraig.