Re: patch: toggle-btn-get-active
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list redhat com
- Subject: Re: patch: toggle-btn-get-active
- Date: 20 Jan 1999 18:14:26 -0500
"Shawn T . Amundson" <firstname.lastname@example.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.
] [Thread Prev