Re: libvirt boolean type

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

 



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.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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