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

Re: [libvirt] [PATCH] util: warn when passing a non-pointer to VIR_FREE



Hey,

On Fri, Apr 22, 2011 at 05:36:25PM -0600, Eric Blake wrote:
> That evaluates ptr twice.  We can do better, by exploiting that the
> ternary operator can be used to determine the type of an expression
> without evaluating it.  Gcc allows 1?(void*)expr:pointer (the resulting
> type is void*), but hates 1?(void*)expr:int (promoting to int provokes a
> warning):
> 
> cc1: warnings being treated as errors
> remote.c: In function 'remoteDispatchListNetworks':
> remote.c:3684:70: error: pointer/integer type mismatch in conditional
> expression
> 
> So how about:

Sorry for the late answer, but this looks good to me too. Let's hope gcc
doesn't get too clever and never stops warning about this.

Thanks,

Christophe

Attachment: pgpYcKE56ie60.pgp
Description: PGP signature


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