Where are defined GLib types in the new doc?

I was looking for information about gssize and other GLib types and I found that page on the web:

But I can not find an equivalent page in the new GLib doc site:

They aren’t, at the moment. Most of the GLib types are really re-implementations of the C99 types, and you should prefer C99 types for newly written code.

I’d be happy to review a port of the old “basic types” document in Markdown format, as a merge request against the docs-gtk-org branch of the GTK repository, which is how the docs.gtk.org website is generated.

Thanks @ebassi for your answer,

in fact, I am working on my Fortran bindings and I am embarrassed with gssize which is an alias for ssize_t (signed size_t) which is a POSIX type (modern Fortran knows only the standard C types). It seems I am obliged to suppose (or hope) that it will be the same as the C size_t in most cases.

GLib discovers the size of size_t at configuration time, and defines gsize as the storage type that matches that size; so you get something like:

typedef unsigned long long gsize;

Then it uses the signed modifier for defining gssize:

typedef signed long long gssize;

Internally, we have a static assertion that the size of gsize and the size of size_t are the same:

G_STATIC_ASSERT (sizeof (gssize) == sizeof (size_t));

to ensure compatibility between GLib types and C99 types. Since gssize is a hard coded as a signed version of size_t, you can assume it passes a similar check.

The old API reference should not have shown the full typedef, because that’s the result of building GLib on the machine that generated the documentation.

1 Like

Thanks a lot for that precise answer!

Note also that on this page of the new GLib doc GLib.SIZEOF_SSIZE_T
it is said that:




On a 32 bits system, I guess it is 4.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.