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

Re: [libvirt] libvirt boolean type



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


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