Re: g_strdupv



Martin Baulig <martin home-of-linux org> writes:

> Hi,
> 
> is there a reason why g_strdupv() takes a `gchar **str_array'
> and not a `const gchar **str_array' ?

Because if g_strdupv() is prototyped as 
 
 g_strdupv (const gchar **str_array);

Then 

 char **a = g_strdupv (some_arr);
 b = g_strdupv (a);

Is not legal - there is no automatic conversion here. You have 
to write:

 b = g_strdupv ((const char **)a);

Of course, then you need casts for const arrays, but the way we do it,
people who don't use const never have to case, people who
use const, have to cast sometimes.

Regards,
                                        Owen 
 




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