Re: libvirt boolean type

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

 



At Fri, 11 Jan 2013 16:11:35 +0000,
Daniel P. Berrange wrote:

[Daniel, I meant to send my reply to the list on Friday. Maybe it got
 stuck somewhere or I had only sent it to you alone - I was using a
 different MUA using a Live-CD... Sorry for the duplicate, if any.]
 
> On Fri, Jan 11, 2013 at 04:40:31PM +0100, Claudio Bley wrote:
> > Hi.
> > 
> > The following patch's intend is to get a discussion started first.
> > 
> > Rationale:
> > 
> > Many functions in libvirt return "1 for <TRUE>, 0 for <FALSE> and -1
> > on <ERROR>".
> > 
> > When calling a function you need to read the documentation, skipping
> > to the "Returns:" text in order to determine what return values to
> > expect from the function and how to interpret them.
> > 
> > This is cumbersome and takes an extra step which could be avoided.
> > 
> > Advantages:
> > 
> > + enum is binary compatible with int, so no ABI changes
> 
> I'm afraid that is wrong. Size of enums is undefined in C. The compiler
> is free to use any integer size to represent an enum. As such we have a
> rule that no enums are allowed in libvirt API signatures.

That's too bad. This surely diminishes the value of this addition (a
bit).

Nonetheless, I think it still would be valuable as point 2 and 3 still
hold. Just change the definition to:

typedef int virBool;

Claudio
-- 
AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>

Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern

--
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]