Re: Raising the abstraction level




On 11-Apr-98 Marius Vollmer wrote:
> tiggr@gerbil.org (Pieter Schoenmakers) writes:
> 
>> The gtk_widget_ref however does not offer any extra functionality,
>> and should be deleted.
> 
> It is meant to save you a few casts, just for cosmetic reasons.  A bit
> dubious, agreed.  gtk_widget_ref will always be the same as
> gtk_object_ref.

I was thinking about this. One way to save typing
would be to make gtk_object_ref a macro which invokes
_gtk_object_ref, with the proper casts.

#define gtk_object_ref( obj ) _gtk_object_ref( GTK_OBJECT( obj ) )

where _gtk_object_ref is the real C function.

then just call gtk_object_ref() with any object
inherited from GtkObject, and it's done.

This could be used to rid all the "member" function
calls of any casts previously necessary, for a
specific object type. For example:

#define gtk_label_set( label, name ) \
         _gtk_label_set( GTK_LABEL( label ), name )

and just call it on a widget pointer, without an
explicit cast.

This would involve alot of work going through
and changing all the "member" function calls,
and you'd still have to use casts for simple
pointer assignments, though, which is sort of
inconsistent.

        Peter.



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