Synopsis#include <glib.h> typedef gboolean; typedef gpointer; typedef gconstpointer; typedef gchar; typedef guchar; typedef gint; typedef guint; typedef gshort; typedef gushort; typedef glong; typedef gulong; typedef gint8; typedef guint8; typedef gint16; typedef guint16; typedef gint32; typedef guint32; #define G_HAVE_GINT64 typedef gint64; GLIB_VAR guint64 (); #define G_GINT64_CONSTANT (val) #define G_GUINT64_CONSTANT (val) typedef gfloat; typedef gdouble; typedef gsize; typedef gssize; typedef goffset; DescriptionGLib defines a number of commonly used types, which can be divided into 4 groups:
Detailsgboolean
A standard boolean type.
Variables of this type should only contain the value gconstpointerAn untyped pointer to constant data. The data pointed to should not be changed. This is typically used in function prototypes to indicate that the data pointed to will not be altered by the function. gintCorresponds to the standard C int type. Values of this type can range from G_MININT to G_MAXINT. guintCorresponds to the standard C unsigned int type. Values of this type can range from 0 to G_MAXUINT. gshortCorresponds to the standard C short type. Values of this type can range from G_MINSHORT to G_MAXSHORT. gushortCorresponds to the standard C unsigned short type. Values of this type can range from 0 to G_MAXUSHORT. glongCorresponds to the standard C long type. Values of this type can range from G_MINLONG to G_MAXLONG. gulongCorresponds to the standard C unsigned long type. Values of this type can range from 0 to G_MAXULONG. gint8typedef signed char gint8; A signed integer guaranteed to be 8 bits on all platforms. Values of this type can range from -128 to 127. guint8typedef unsigned char guint8; An unsigned integer guaranteed to be 8 bits on all platforms. Values of this type can range from 0 to 255. gint16typedef signed short gint16; A signed integer guaranteed to be 16 bits on all platforms. Values of this type can range from -32,768 to 32,767. guint16typedef unsigned short guint16; An unsigned integer guaranteed to be 16 bits on all platforms. Values of this type can range from 0 to 65,535. gint32typedef signed int gint32; A signed integer guaranteed to be 32 bits on all platforms. Values of this type can range from -2,147,483,648 to 2,147,483,647. guint32typedef unsigned int guint32; An unsigned integer guaranteed to be 32 bits on all platforms. Values of this type can range from 0 to 4,294,967,295. G_HAVE_GINT64#define G_HAVE_GINT64 1 /* deprecated, always true */ Warning
This macro is defined if 64-bit signed and unsigned integers are available on the platform. gint64G_GNUC_EXTENSION typedef signed long long gint64; A signed integer guaranteed to be 64 bits on all platforms. Values of this type can range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. guint64 ()GLIB_VAR guint64 (); An unsigned integer guaranteed to be 64 bits on all platforms. Values of this type can range from 0 to 18,446,744,073,709,551,615.
G_GINT64_CONSTANT()#define G_GINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##LL)) This macro is used to insert 64-bit integer literals into the source code.
G_GUINT64_CONSTANT()#define G_GUINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##ULL)) This macro is used to insert 64-bit unsigned integer literals into the source code.
Since 2.10 gfloatCorresponds to the standard C float type. Values of this type can range from -G_MAXFLOAT to G_MAXFLOAT. gdoubleCorresponds to the standard C double type. Values of this type can range from -G_MAXDOUBLE to G_MAXDOUBLE. gsizetypedef unsigned int gsize; An unsigned integer type of the result of the sizeof operator, corresponding to the size_t type defined in C99. This type is wide enough to hold the numeric value of a pointer, so it is usually 32bit wide on a 32bit platform and 64bit wide on a 64bit platform. gssizetypedef signed int gssize; A signed variant of gsize, corresponding to the ssize_t defined on most platforms. | ||||||||||||||||