gvariant: Document the need to cast varargs when constructing GVariants

Slightly expand on the documentation about casting varargs when
constructing GVariants, and link to it from all the functions where it’s
a necessary consideration.

Add an example of passing flags to a ‘t’ type variable (guint64).
Assuming the flags enum does not have many members, the flag variable
will be 32 bits wide, and needs an explicit cast to be passed into
g_variant_new() as a 64-bit value.

https://bugzilla.gnome.org/show_bug.cgi?id=712837
This commit is contained in:
Philip Withnall
2013-11-21 17:39:16 +00:00
parent 3f3d2976d1
commit 2b8edf234c
3 changed files with 36 additions and 0 deletions

View File

@@ -466,6 +466,7 @@
</tgroup>
</informaltable>
<anchor id='gvariant-varargs'/>
<para>
Note that in C, small integer types in variable argument lists are promoted up to <link
linkend='gint'><type>int</type></link> or <link linkend='guint'><type>unsigned int</type></link> as appropriate, and