Re: [PATCH 2/6] core: changed type of date keys to GDateTime



On Thu, 2011-06-30 at 12:16 +0200, Guillaume Emont wrote:
> > My point is that looking how other libraries do, including GLib,
> almost
> > I never saw the use of a 'const' in other place than strings. Taking
> a
> > look, for instance, in the GList, GObject or GTimeVal API, there is
> no
> > trail of 'const' in any parameter than strings, even when the
> > object/struct is not modified.
> Yeah, and I personally hate them for that, for all the times when I
> had
> to do:
> GList *list_I_can_modify =
>   g_list_copy((GList *)const_list_I_cant_modify); 

That's my point: they assume that your 'const_list_I_cant_modify' is a
'GList', not a 'const GList'. No function returns a 'const GList *' so
there is no reason to define it as const.

If your API has functions handling 'const GList *', then you need to do
the cast. That's another reason why I would prefer that all our API use
'GList *' and not 'const GList *'.

	J.A.




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