[Spice-devel] bool or gboolean
Frediano Ziglio
fziglio at redhat.com
Wed Feb 15 16:39:32 UTC 2017
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)
- 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).
For opinions
- bool/gboolean
- bool
> +1
- gboolean
- consistent with type
- yes
> +1
- no
Frediano
More information about the Spice-devel
mailing list