1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 a portable method for storing #gint & #guint values in #gpointer variables.
7 <!-- ##### SECTION Long_Description ##### -->
9 These macros provide a portable method of storing #gint and #guint values in
13 Many of the GLib data types are based on storing #gpointer values,
14 e.g. #GHashTable, #GList, #GSList, #GTree, and #GNode.
15 By using the type conversion macros described below you can store #gint and
16 #guint values inside a #gpointer. So you can, for example, create
17 a hash table of #gint values, or a linked list of #guint values.
20 The type conversion macros are necessary because the size of a #gpointer can
21 vary across different platforms. So the type conversion has to be done
25 Note that the reverse operation, storing #gpointer values in
26 integer variables, is not supported, since an integer is not guaranteed to
27 be large enough to store #gpointer values across all platforms.
30 To convert an integer value, a #gint, to a #gpointer, use #GINT_TO_POINTER.
31 To convert it back to a #gint, use #GPOINTER_TO_INT.
34 To convert an unsigned integer, a #guint, to a #gpointer, use
35 #GUINT_TO_POINTER. To convert it back to a #guint, use #GPOINTER_TO_UINT.
38 <!-- ##### SECTION See_Also ##### -->
43 <!-- ##### MACRO GINT_TO_POINTER ##### -->
45 Converts a #gint to a #gpointer.
49 @Returns: the value converted to a #gpointer.
52 <!-- ##### MACRO GPOINTER_TO_INT ##### -->
54 Converts a #gpointer to a #gint.
57 @p: a #gpointer value.
58 @Returns: the value converted to a #gint.
61 <!-- ##### MACRO GUINT_TO_POINTER ##### -->
63 Converts a #guint to a #gpointer.
67 @Returns: the value converted to a #gpointer.
70 <!-- ##### MACRO GPOINTER_TO_UINT ##### -->
72 Converts a #gpointer to a #guint.
75 @p: a #gpointer value.
76 @Returns: the value converted to a #guint.