Re: g_object_[add|remove]_weak_pointer needs an explicit cast



On 19 Aug 2001, Sven Neumann wrote:

> Hi,
> 
> I've added this code myself, but have now found that to use 
> g_object_[add|remove]_weak_pointer() one has to write code
> like
> 
>  g_object_add_weak_pointer (G_OBJECT (foo->object),
>                             (gpointer *) &foo->object);
> 
> since gcc doesn't seem to like the simpler
> 
>  g_object_add_weak_pointer (G_OBJECT (foo->object),
>                             &foo->object);
> 
> I propose we apply the attached simple patch to remove the
> need to insert an explicit cast. The name weak_pointer_location
> should be clear enough to outline that we expect a pointer to
> a pointer location here. Any objections?
> 

>  void        g_object_add_weak_pointer         (GObject        *object, 
> -                                               gpointer       *weak_pointer_location);
> +                                               gpointer        weak_pointer_location);

nope, that's fine. the same thing should be done for:

gboolean              g_module_symbol        (GModule      *module,
                                              const gchar  *symbol_name,
                                              gpointer     *symbol);

as in its current incarnation, it requires casting for
the symbol location in 95% usage cases.

> 
> Salut, Sven
> 

---
ciaoTJ





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