qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 02/17] qom: Clean up inconsistent use of gchar * vs. char *


From: Markus Armbruster
Subject: Re: [PATCH 02/17] qom: Clean up inconsistent use of gchar * vs. char *
Date: Mon, 04 May 2020 17:27:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Daniel P. Berrangé <address@hidden> writes:

> On Sat, May 02, 2020 at 07:06:38AM +0200, Markus Armbruster wrote:
>> Eric Blake <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]