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

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

 



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: pgpjm7bQj7Yfd.pgp
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]