Re: Abuse of 'const' ?

2013-04-11 Thread Bernhard Schuster
const is left binding unless there is nothing to the left - then it binds
to the right.


2013/4/8 John Emmas john...@tiscali.co.uk

 On 08/04/2013 14:09, Ryan Lortie wrote:


 A 'const gchar **' is (in this case) an array of 'const gchar *' (ie:
 const string pointers).  It is the strings that are immutable.  The array
 itself is fully writable, and indeed you should free what
 g_variant_get_bytestring_**array() returns to you, using g_free().


 Good clarification Ryan.  Thanks!

 __**_
 gtk-devel-list mailing list
 gtk-devel-list@gnome.org
 https://mail.gnome.org/**mailman/listinfo/gtk-devel-**listhttps://mail.gnome.org/mailman/listinfo/gtk-devel-list

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Abuse of 'const' ?

2013-04-08 Thread Ryan Lortie

hi John,

On 2013-04-08 04:44, John Emmas wrote:

// glib/gvariant.h
GLIB_AVAILABLE_IN_ALL
const gchar **g_variant_get_bytestring_array (GVariant *value, gsize
*length);


// glib/gvariant.c
static gpointer
g_variant_valist_get_nnp (const gchar **str, GVariant *value)
{
 // some stuff
 return g_variant_get_bytestring_array (value, NULL);
}



A 'const gchar **' is (in this case) an array of 'const gchar *' (ie: 
const string pointers).  It is the strings that are immutable.  The 
array itself is fully writable, and indeed you should free what 
g_variant_get_bytestring_array() returns to you, using g_free().


By the same token it is therefore perfectly acceptable to pass it 
through a gpointer.


Cheers
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Abuse of 'const' ?

2013-04-08 Thread John Emmas

On 08/04/2013 14:09, Ryan Lortie wrote:


A 'const gchar **' is (in this case) an array of 'const gchar *' (ie: 
const string pointers).  It is the strings that are immutable.  The 
array itself is fully writable, and indeed you should free what 
g_variant_get_bytestring_array() returns to you, using g_free().




Good clarification Ryan.  Thanks!
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list