| <!-- ##### SECTION Title ##### --> |
| Basic Types |
| |
| <!-- ##### SECTION Short_Description ##### --> |
| standard GLib types, defined for ease-of-use and portability |
| |
| <!-- ##### SECTION Long_Description ##### --> |
| <para> |
| GLib defines a number of commonly used types, which can be divided into |
| 4 groups: |
| |
| <itemizedlist> |
| <listitem><para> |
| New types which are not part of standard C (but are defined |
| in various C standard library header files) - |
| #gboolean, #gsize, #gssize, #goffset, #gintptr, #guintptr. |
| </para></listitem> |
| |
| <listitem><para> |
| Integer types which are guaranteed to be the same size across all platforms - |
| #gint8, #guint8, #gint16, #guint16, #gint32, #guint32, #gint64, #guint64. |
| </para></listitem> |
| |
| <listitem><para> |
| Types which are easier to use than their standard C counterparts - |
| #gpointer, #gconstpointer, #guchar, #guint, #gushort, #gulong. |
| </para></listitem> |
| |
| <listitem><para> |
| Types which correspond exactly to standard C types, but are included |
| for completeness - #gchar, #gint, #gshort, #glong, #gfloat, #gdouble. |
| </para></listitem> |
| </itemizedlist> |
| |
| </para> |
| |
| <!-- ##### SECTION See_Also ##### --> |
| <para> |
| |
| </para> |
| |
| <!-- ##### SECTION Stability_Level ##### --> |
| |
| |
| <!-- ##### SECTION Image ##### --> |
| |
| |
| <!-- ##### TYPEDEF gboolean ##### --> |
| <para> |
| A standard <type>boolean</type> type. |
| Variables of this type should only contain the value %TRUE or %FALSE. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF gpointer ##### --> |
| <para> |
| An untyped pointer. |
| #gpointer looks better and is easier to use than <type>void*</type>. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF gconstpointer ##### --> |
| <para> |
| An untyped pointer to constant data. |
| The data pointed to should not be changed. |
| </para> |
| <para> |
| This is typically used in function prototypes to indicate that the |
| data pointed to will not be altered by the function. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF gchar ##### --> |
| <para> |
| Corresponds to the standard C <type>char</type> type. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF guchar ##### --> |
| <para> |
| Corresponds to the standard C <type>unsigned char</type> type. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF gint ##### --> |
| <para> |
| Corresponds to the standard C <type>int</type> type. |
| Values of this type can range from #G_MININT to #G_MAXINT. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF guint ##### --> |
| <para> |
| Corresponds to the standard C <type>unsigned int</type> type. |
| Values of this type can range from 0 to #G_MAXUINT. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF gshort ##### --> |
| <para> |
| Corresponds to the standard C <type>short</type> type. |
| Values of this type can range from #G_MINSHORT to #G_MAXSHORT. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF gushort ##### --> |
| <para> |
| Corresponds to the standard C <type>unsigned short</type> type. |
| Values of this type can range from 0 to #G_MAXUSHORT. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF glong ##### --> |
| <para> |
| Corresponds to the standard C <type>long</type> type. |
| Values of this type can range from #G_MINLONG to #G_MAXLONG. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF gulong ##### --> |
| <para> |
| Corresponds to the standard C <type>unsigned long</type> type. |
| Values of this type can range from 0 to #G_MAXULONG. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF gint8 ##### --> |
| <para> |
| A signed integer guaranteed to be 8 bits on all platforms. |
| Values of this type can range from #G_MININT8 (= -128) to |
| #G_MAXINT8 (= 127). |
| </para> |
| |
| |
| <!-- ##### TYPEDEF guint8 ##### --> |
| <para> |
| An unsigned integer guaranteed to be 8 bits on all platforms. |
| Values of this type can range from 0 to #G_MAXUINT8 (= 255). |
| </para> |
| |
| |
| <!-- ##### TYPEDEF gint16 ##### --> |
| <para> |
| A signed integer guaranteed to be 16 bits on all platforms. |
| Values of this type can range from #G_MININT16 (= -32,768) to |
| #G_MAXINT16 (= 32,767). |
| </para> |
| <para> |
| To print or scan values of this type, use |
| %G_GINT16_MODIFIER and/or %G_GINT16_FORMAT. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF guint16 ##### --> |
| <para> |
| An unsigned integer guaranteed to be 16 bits on all platforms. |
| Values of this type can range from 0 to #G_MAXUINT16 (= 65,535). |
| </para> |
| <para> |
| To print or scan values of this type, use |
| %G_GINT16_MODIFIER and/or %G_GUINT16_FORMAT. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF gint32 ##### --> |
| <para> |
| A signed integer guaranteed to be 32 bits on all platforms. |
| Values of this type can range from #G_MININT32 (= -2,147,483,648) to |
| #G_MAXINT32 (= 2,147,483,647). |
| </para> |
| <para> |
| To print or scan values of this type, use |
| %G_GINT32_MODIFIER and/or %G_GINT32_FORMAT. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF guint32 ##### --> |
| <para> |
| An unsigned integer guaranteed to be 32 bits on all platforms. |
| Values of this type can range from 0 to #G_MAXUINT32 (= 4,294,967,295). |
| </para> |
| <para> |
| To print or scan values of this type, use |
| %G_GINT32_MODIFIER and/or %G_GUINT32_FORMAT. |
| </para> |
| |
| |
| <!-- ##### MACRO G_HAVE_GINT64 ##### --> |
| <para> |
| This macro is defined if 64-bit signed and unsigned integers are available |
| on the platform. |
| </para> |
| |
| @Deprecated: GLib requires 64-bit integer support since version 2.0, therefore |
| %G_HAVE_GINT64 is <emphasis>always</emphasis> defined. |
| |
| |
| <!-- ##### TYPEDEF gint64 ##### --> |
| <para> |
| A signed integer guaranteed to be 64 bits on all platforms. |
| Values of this type can range from #G_MININT64 (= -9,223,372,036,854,775,808) to |
| #G_MAXINT64 (= 9,223,372,036,854,775,807). |
| </para> |
| <para> |
| To print or scan values of this type, use |
| %G_GINT64_MODIFIER and/or %G_GINT64_FORMAT. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF guint64 ##### --> |
| <para> |
| An unsigned integer guaranteed to be 64 bits on all platforms. |
| Values of this type can range from 0 to #G_MAXUINT64 (= 18,446,744,073,709,551,615). |
| </para> |
| <para> |
| To print or scan values of this type, use |
| %G_GINT64_MODIFIER and/or %G_GUINT64_FORMAT. |
| </para> |
| |
| |
| <!-- ##### MACRO G_GINT64_CONSTANT ##### --> |
| <para> |
| This macro is used to insert 64-bit integer literals into the source code. |
| </para> |
| |
| @val: a literal integer value, e.g. 0x1d636b02300a7aa7. |
| |
| |
| <!-- ##### MACRO G_GUINT64_CONSTANT ##### --> |
| <para> |
| This macro is used to insert 64-bit unsigned integer literals into the |
| source code. |
| </para> |
| |
| @val: a literal integer value, e.g. 0x1d636b02300a7aa7U. |
| @Since: 2.10 |
| |
| |
| <!-- ##### TYPEDEF gfloat ##### --> |
| <para> |
| Corresponds to the standard C <type>float</type> type. |
| Values of this type can range from -#G_MAXFLOAT to #G_MAXFLOAT. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF gdouble ##### --> |
| <para> |
| Corresponds to the standard C <type>double</type> type. |
| Values of this type can range from -#G_MAXDOUBLE to #G_MAXDOUBLE. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF gsize ##### --> |
| <para> |
| 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. |
| Values of this type can range from 0 to #G_MAXSIZE. |
| </para> |
| <para> |
| To print or scan values of this type, use |
| %G_GSIZE_MODIFIER and/or %G_GSIZE_FORMAT. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF gssize ##### --> |
| <para> |
| A signed variant of gsize, corresponding to the ssize_t defined on most platforms. |
| Values of this type can range from #G_MINSSIZE to #G_MAXSSIZE. |
| </para> |
| <para> |
| To print or scan values of this type, use |
| %G_GSIZE_MODIFIER and/or %G_GSSIZE_FORMAT. |
| </para> |
| |
| |
| <!-- ##### TYPEDEF goffset ##### --> |
| <para> |
| A signed integer type that is used for file offsets, corresponding to the |
| C99 type off64_t. |
| Values of this type can range from #G_MINOFFSET to #G_MAXOFFSET. |
| </para> |
| <para> |
| To print or scan values of this type, use |
| %G_GOFFSET_MODIFIER and/or %G_GOFFSET_FORMAT. |
| </para> |
| |
| Since: 2.14 |
| |
| |
| <!-- ##### MACRO G_GOFFSET_CONSTANT ##### --> |
| <para> |
| This macro is used to insert #goffset 64-bit integer literals into the source code. |
| See also #G_GINT64_CONSTANT. |
| </para> |
| |
| @val: a literal integer value, e.g. 0x1d636b02300a7aa7. |
| Since: 2.20 |
| |
| |
| <!-- ##### TYPEDEF gintptr ##### --> |
| <para> |
| Corresponds to the C99 type <type>intptr_t</type>, a signed integer type that |
| can hold any pointer. |
| </para> |
| <para> |
| To print or scan values of this type, use |
| %G_GINTPTR_MODIFIER and/or %G_GINTPTR_FORMAT. |
| </para> |
| |
| Since: 2.18 |
| |
| |
| <!-- ##### TYPEDEF guintptr ##### --> |
| <para> |
| Corresponds to the C99 type <type>uintptr_t</type>, an unsigned integer type that |
| can hold any pointer. |
| </para> |
| <para> |
| To print or scan values of this type, use |
| %G_GINTPTR_MODIFIER and/or %G_GUINTPTR_FORMAT. |
| </para> |
| |
| Since: 2.18 |
| |
| |