1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 standard GLib types, defined for ease-of-use and portability
7 <!-- ##### SECTION Long_Description ##### -->
9 GLib defines a number of commonly used types, which can be divided into
14 New types which are not part of standard C (but are defined
15 in various C standard library header files) -
16 #gboolean, #gsize, #gssize, #goffset, #gintptr, #guintptr.
20 Integer types which are guaranteed to be the same size across all platforms -
21 #gint8, #guint8, #gint16, #guint16, #gint32, #guint32, #gint64, #guint64.
25 Types which are easier to use than their standard C counterparts -
26 #gpointer, #gconstpointer, #guchar, #guint, #gushort, #gulong.
30 Types which correspond exactly to standard C types, but are included
31 for completeness - #gchar, #gint, #gshort, #glong, #gfloat, #gdouble.
37 <!-- ##### SECTION See_Also ##### -->
42 <!-- ##### SECTION Stability_Level ##### -->
45 <!-- ##### SECTION Image ##### -->
48 <!-- ##### TYPEDEF gboolean ##### -->
50 A standard <type>boolean</type> type.
51 Variables of this type should only contain the value %TRUE or %FALSE.
55 <!-- ##### TYPEDEF gpointer ##### -->
58 #gpointer looks better and is easier to use than <type>void*</type>.
62 <!-- ##### TYPEDEF gconstpointer ##### -->
64 An untyped pointer to constant data.
65 The data pointed to should not be changed.
68 This is typically used in function prototypes to indicate that the
69 data pointed to will not be altered by the function.
73 <!-- ##### TYPEDEF gchar ##### -->
75 Corresponds to the standard C <type>char</type> type.
79 <!-- ##### TYPEDEF guchar ##### -->
81 Corresponds to the standard C <type>unsigned char</type> type.
85 <!-- ##### TYPEDEF gint ##### -->
87 Corresponds to the standard C <type>int</type> type.
88 Values of this type can range from #G_MININT to #G_MAXINT.
92 <!-- ##### TYPEDEF guint ##### -->
94 Corresponds to the standard C <type>unsigned int</type> type.
95 Values of this type can range from 0 to #G_MAXUINT.
99 <!-- ##### TYPEDEF gshort ##### -->
101 Corresponds to the standard C <type>short</type> type.
102 Values of this type can range from #G_MINSHORT to #G_MAXSHORT.
106 <!-- ##### TYPEDEF gushort ##### -->
108 Corresponds to the standard C <type>unsigned short</type> type.
109 Values of this type can range from 0 to #G_MAXUSHORT.
113 <!-- ##### TYPEDEF glong ##### -->
115 Corresponds to the standard C <type>long</type> type.
116 Values of this type can range from #G_MINLONG to #G_MAXLONG.
120 <!-- ##### TYPEDEF gulong ##### -->
122 Corresponds to the standard C <type>unsigned long</type> type.
123 Values of this type can range from 0 to #G_MAXULONG.
127 <!-- ##### TYPEDEF gint8 ##### -->
129 A signed integer guaranteed to be 8 bits on all platforms.
130 Values of this type can range from #G_MININT8 (= -128) to
135 <!-- ##### TYPEDEF guint8 ##### -->
137 An unsigned integer guaranteed to be 8 bits on all platforms.
138 Values of this type can range from 0 to #G_MAXUINT8 (= 255).
142 <!-- ##### TYPEDEF gint16 ##### -->
144 A signed integer guaranteed to be 16 bits on all platforms.
145 Values of this type can range from #G_MININT16 (= -32,768) to
146 #G_MAXINT16 (= 32,767).
149 To print or scan values of this type, use
150 %G_GINT16_MODIFIER and/or %G_GINT16_FORMAT.
154 <!-- ##### TYPEDEF guint16 ##### -->
156 An unsigned integer guaranteed to be 16 bits on all platforms.
157 Values of this type can range from 0 to #G_MAXUINT16 (= 65,535).
160 To print or scan values of this type, use
161 %G_GINT16_MODIFIER and/or %G_GUINT16_FORMAT.
165 <!-- ##### TYPEDEF gint32 ##### -->
167 A signed integer guaranteed to be 32 bits on all platforms.
168 Values of this type can range from #G_MININT32 (= -2,147,483,648) to
169 #G_MAXINT32 (= 2,147,483,647).
172 To print or scan values of this type, use
173 %G_GINT32_MODIFIER and/or %G_GINT32_FORMAT.
177 <!-- ##### TYPEDEF guint32 ##### -->
179 An unsigned integer guaranteed to be 32 bits on all platforms.
180 Values of this type can range from 0 to #G_MAXUINT32 (= 4,294,967,295).
183 To print or scan values of this type, use
184 %G_GINT32_MODIFIER and/or %G_GUINT32_FORMAT.
188 <!-- ##### MACRO G_HAVE_GINT64 ##### -->
190 This macro is defined if 64-bit signed and unsigned integers are available
194 @Deprecated: GLib requires 64-bit integer support since version 2.0, therefore
195 %G_HAVE_GINT64 is <emphasis>always</emphasis> defined.
198 <!-- ##### TYPEDEF gint64 ##### -->
200 A signed integer guaranteed to be 64 bits on all platforms.
201 Values of this type can range from #G_MININT64 (= -9,223,372,036,854,775,808) to
202 #G_MAXINT64 (= 9,223,372,036,854,775,807).
205 To print or scan values of this type, use
206 %G_GINT64_MODIFIER and/or %G_GINT64_FORMAT.
210 <!-- ##### TYPEDEF guint64 ##### -->
212 An unsigned integer guaranteed to be 64 bits on all platforms.
213 Values of this type can range from 0 to #G_MAXUINT64 (= 18,446,744,073,709,551,615).
216 To print or scan values of this type, use
217 %G_GINT64_MODIFIER and/or %G_GUINT64_FORMAT.
221 <!-- ##### MACRO G_GINT64_CONSTANT ##### -->
223 This macro is used to insert 64-bit integer literals into the source code.
226 @val: a literal integer value, e.g. 0x1d636b02300a7aa7.
229 <!-- ##### MACRO G_GUINT64_CONSTANT ##### -->
231 This macro is used to insert 64-bit unsigned integer literals into the
235 @val: a literal integer value, e.g. 0x1d636b02300a7aa7U.
239 <!-- ##### TYPEDEF gfloat ##### -->
241 Corresponds to the standard C <type>float</type> type.
242 Values of this type can range from -#G_MAXFLOAT to #G_MAXFLOAT.
246 <!-- ##### TYPEDEF gdouble ##### -->
248 Corresponds to the standard C <type>double</type> type.
249 Values of this type can range from -#G_MAXDOUBLE to #G_MAXDOUBLE.
253 <!-- ##### TYPEDEF gsize ##### -->
255 An unsigned integer type of the result of the sizeof operator, corresponding
256 to the size_t type defined in C99. This type is wide enough to hold the numeric
257 value of a pointer, so it is usually 32bit wide on a 32bit platform and
258 64bit wide on a 64bit platform.
259 Values of this type can range from 0 to #G_MAXSIZE.
262 To print or scan values of this type, use
263 %G_GSIZE_MODIFIER and/or %G_GSIZE_FORMAT.
267 <!-- ##### TYPEDEF gssize ##### -->
269 A signed variant of gsize, corresponding to the ssize_t defined on most platforms.
270 Values of this type can range from #G_MINSSIZE to #G_MAXSSIZE.
273 To print or scan values of this type, use
274 %G_GSIZE_MODIFIER and/or %G_GSSIZE_FORMAT.
278 <!-- ##### TYPEDEF goffset ##### -->
280 A signed integer type that is used for file offsets, corresponding to the
282 Values of this type can range from #G_MINOFFSET to #G_MAXOFFSET.
285 To print or scan values of this type, use
286 %G_GOFFSET_MODIFIER and/or %G_GOFFSET_FORMAT.
292 <!-- ##### MACRO G_GOFFSET_CONSTANT ##### -->
294 This macro is used to insert #goffset 64-bit integer literals into the source code.
295 See also #G_GINT64_CONSTANT.
298 @val: a literal integer value, e.g. 0x1d636b02300a7aa7.
302 <!-- ##### TYPEDEF gintptr ##### -->
304 Corresponds to the C99 type <type>intptr_t</type>, a signed integer type that
305 can hold any pointer.
308 To print or scan values of this type, use
309 %G_GINTPTR_MODIFIER and/or %G_GINTPTR_FORMAT.
315 <!-- ##### TYPEDEF guintptr ##### -->
317 Corresponds to the C99 type <type>uintptr_t</type>, an unsigned integer type that
318 can hold any pointer.
321 To print or scan values of this type, use
322 %G_GINTPTR_MODIFIER and/or %G_GUINTPTR_FORMAT.