Daniel P. Berrangé <berra...@redhat.com> writes:

> On Sat, May 02, 2020 at 07:06:38AM +0200, Markus Armbruster wrote:
>> Eric Blake <ebl...@redhat.com> writes:
>> 
>> > On 4/28/20 11:34 AM, Markus Armbruster wrote:
>> >> Uses of gchar * in qom/object.h:
>> >>
>> >
>> > Nice audit.  I don't know if we can blindly assume that 'gchar' is a
>> > (stupid) typedef to 'char', or if they can ever differ, but avoiding
>> > gchar where possible always makes sense to me.
>> 
>> GLib's "basic types" are one of the most misguided aspects of its
>> interface.
>
> There is work to re-define them in terms of stdint.h
>
>    https://gitlab.gnome.org/GNOME/glib/issues/1484
>
> with long term possible plan to deprecate them

Long overdue.

>> Quote https://developer.gnome.org/glib/stable/glib-Basic-Types.html
>> 
>>     GLib defines a number of commonly used types, which can be divided
>>     into several groups:
>> 
>>         New types which are not part of standard C (but are defined in
>>         various C standard library header files) — gboolean, gssize.
>> 
>> Stuck in the 90s.
>
> snip
>
>> Purge with fire.
>
> Note  gboolean is a trap door. Any code integrating with GLib APIs that
> use "gboolean" in their signature must keep using that. It is *NOT*
> interchangable with the "bool" from stdbool.h.
>
>   "gboolean" is a typedef for "gint"
>   "bool" is a "_Bool" which is just a single byte.
>
> Also note TRUE and true are not the same value.
>
>   'TRUE' is bitwise !FALSE
>   'true' is 1

Yes, gboolean is the worst of the lot, and pretty much impossible to
eliminate.


Reply via email to