|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 14/22] libelf: use C99 bool for booleans
Andrew Cooper writes ("Re: [PATCH 14/22] libelf: use C99 bool for booleans"):
> On 07/06/13 19:27, Ian Jackson wrote:
> > @@ -46,7 +46,7 @@ static void log_callback(struct elf_binary *elf, void
> > *caller_data,
> >
> > void xc_elf_set_logfile(xc_interface *xch, struct elf_binary *elf,
> > int verbose) {
> > - elf_set_log(elf, log_callback, xch, verbose);
> > + elf_set_log(elf, log_callback, xch, verbose /* convert to bool */);
>
> Change the function prototype from int verbose to bool verbose ?
>
> If not, for API reasons, then use !!verbose to correctly convert an
> integer to a boolean.
Not, for API reasons, as you surmise. As I write in the commit
message:
For the one visible libelf boolean in libxc's public interface we
retain the use of int to avoid changing the ABI; libxc converts it to
a bool for consumption by libelf.
It is not necessary to use !!verbose. See C99 6.3.1.2. Any
conversion of a scalar to a _Bool is equivalent to a comparison !=0
(which is the same test as for ?: (6.5.15(4)) and "if" (6.8.4.1(2)).
Some of this is explained in the commit message.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |