[Spice-devel] bool or gboolean

Pavel Grunt pgrunt at redhat.com
Thu Feb 16 12:17:42 UTC 2017


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

> 
> For opinions
> 
> - bool/gboolean
>   - bool
> > +1
+1
> 
>   - gboolean
> 
> - consistent with type
>   - yes
> > +1 
+1
> 
>   - no
> 
> Frediano
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list