Re: patch: toggle-btn-get-active



"Shawn T . Amundson" <amundson@gimp.org> writes:

> There are only 3 other examples of using a macro for a *_get_* and
> those are all in gtkcompat.h. 
> 
> Other things which could be written as macros are currently functions,
> such as gtk_button_get_relief(), gtk_editable_get_position(), etc.
> 
> One of the reasons is that the functions provided check to make sure you 
> have the right type of object before accessing it, thus providing a little 
> guard against segfaulting.

We do get the type check - the GTK_TOGGLE_BUTTON() macro does
that. We just don't get the segfault protection. 
 
> If it should be done, it should probably be done consistantly.

> > Is this patch acceptable?   It adds gtk_toggle_button_get_active macro.
> > Doesn't add any code weight, and creates a counterpart to
> > gtk_toggle_button_set_active.
> > 
> > 	Jeff

Another reason to use functions for this type of thing
is that (in theory) it preserves binary compatiblity.

Of course, since people currently write 
GTK_TOGGLE_BUTTON (foo)->active, we don't really gain anything.

                                        Owen



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