[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: |
Sat, 02 May 2020 07:06:38 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
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.
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.
Integer types which are guaranteed to be the same size across
all platforms — gint8, guint8, gint16, guint16, gint32, guint32,
gint64, guint64.
Again.
Types which are easier to use than their standard C counterparts
- gpointer, gconstpointer, guchar, guint, gushort, gulong.
Surely, you're joking Mr. GLib.
Types which correspond exactly to standard C types, but are
included for completeness — gchar, gint, gshort, glong, gfloat,
gdouble.
This answers your question: yes, gchar is exactly char.
It also reminds me of "It has been said that XML is like violence; if a
little doesn't solve the problem, use more."
Types which correspond exactly to standard C99 types, but are
available to use even if your compiler does not support C99 —
gsize, goffset, gintptr, guintptr.
And the 90s again.
Purge with fire.
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
> Reviewed-by: Eric Blake <address@hidden>
Thanks!
- Re: [PATCH 02/17] qom: Clean up inconsistent use of gchar * vs. char *,
Markus Armbruster <=