[Spice-devel] bool or gboolean

Victor Toso victortoso at redhat.com
Mon Feb 20 10:05:26 UTC 2017


Hi,

On Thu, Feb 16, 2017 at 01:24:04PM +0100, Christophe de Dinechin wrote:
> 
> > On 16 Feb 2017, at 13:17, Pavel Grunt <pgrunt at redhat.com> wrote:
> >
> > On Wed, 2017-02-15 at 11:39 -0500, Frediano Ziglio wrote:
> >> Hi,
> >>   question was raised recently on the ML and IRC.
> >>
> >> Some time ago we decided to use gboolean but some of us would like
> >> to discuss again.
> >>
> >> As any style changes there's no right or wrong, mainly personal
> >> opinions but I think consistency is quite important.
> >>
> >> Some consideration (feel free to add/remove/comment)
> >> - gboolean is more used in the code (about 76%)
> >> - TRUE/FALSE are more used (96%)
> >> - bool is C99 convention, defined in stdbool.h
> >> - using gcc the bool type is a bit different from gboolean
> >>   (which basically is an int) catching some problems as
> >>   warnings (like cast between different function pointers
> >>   using bool instead of gboolean/int)
> > this is very important point in my opinion
> >
> >> - bool is easier to write (OT: and my vim is more happy too)
> >>
> >> There are 2 kind of decision:
> >> - prefer bool or gboolean
> >> - stay consistent with constants (bool -> true/false,
> >>   gboolean -> TRUE/FALSE), continue to use TRUE/FALSE.
> >>
> >> I think as usual new code should follow style while old
> >> for "blame" purposes should stay as is (unless code stop
> >> compiling for instance).
> > I agree, no mass rename

IMHO, moving from int to bool where it fits (teuf's patch) would be
great too.

> >
> >> 
> >> For opinions
> >> 
> >> - bool/gboolean
> >>   - bool
> >>> +1
> > +1
> +1
+1

> >>
> >>   - gboolean
> >>
> >> - consistent with type
> >>   - yes
> >>> +1
> > +1
> +1
+1

>
> >>
> >>   - no
> >>
> >> Frediano
> >> _______________________________________________
> >> Spice-devel mailing list
> >> Spice-devel at lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/spice-devel
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170220/0106963a/attachment.sig>


More information about the Spice-devel mailing list