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.

Reply via email to