Skip to content

WIP: Use C99 integer types where appropriate

Emmanuele Bassi requested to merge c99-int-types into master

GLib depends on various parts of a valid C99 toolchain, so it's time to use C99 integer types wherever possible, instead of doing configure-time discovery like it's 1997.

So:

GLib signed C99 signed GLib unsigned C99 unsigned
gint8 int8_t guint8 uint8_t
gint16 int16_t guint16 uint16_t
gint32 int32_t guint32 uint32_t
gint64 int64_t guint64 uint64_t
gsize size_t
gintptr intptr_t guintptr uintptr_t

There are some side effects on switching to C99:

  • the G_*_MODIFIER macros do not really make any more sense, and should be deprecated and replaced by an empty string
  • the G_*_FORMAT macros are marked for use with both printf() and scanf(), except that's not really true at all; C99 defines format macros for print() and scanf() separately, and GLib should do the same. The old macros should be deprecated, but if we want to be evil about it, we could alias them with the PRINTF_FORMAT, as it's likely their more dominant use

In general, there shouldn't be any ABI changes, unless the toolchain in use is not conformant to C99.

Closes #1484 (closed)

Edited by Philip Withnall

Merge request reports