Re: g_slist and const



On Friday 09 March 2007 20:39, Havoc Pennington wrote:
> Hi,
>
> Asbjørn wrote:
> > I'm tightning my code and i wonder why some of the g_slist functions
> > don't use "const".
>
> Here is an old mail on the topic:
> http://mail.gnome.org/archives/gtk-devel-list/2001-May/msg00485.html
>
> Havoc

Ok, i see the point, but i was only thinking abount the  g_list_xx functions 
returning  gint,guint,, (not pointers like GSList *).
So it will only be a few funtions changed.
And i agree that it's not much too win, but i program in C++ where "const" 
matter.

I use C++/glib and i get this  strange looking function:

guint my_class::length (const GSList  *list)  /* const to protect my list */
{
   /* cast it to a non const pointer! */
    return (g_slist_length  ((GSList *) list)); 
}

So i want glib "C" to be more "C++" friendly    :)

Asbjorn



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]