Re: GTK_WINDOW(NULL) (WAS: more patches)
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list gnome org
- Subject: Re: GTK_WINDOW(NULL) (WAS: more patches)
- Date: 02 Mar 2001 21:53:38 -0500
Havoc Pennington <hp redhat com> writes:
> "Craig M. Buchek" <craig buchek com> writes:
> > What if GTK_WINDOW() and friends returned NULL when they are passed
> > NULL?
> >
> > It seems that passing a NULL in place of a widget pointer is a common
> > thing. And casting a NULL is generally a safe operation. I realize that
> > the casting macros also check for the object type, but in many
> > situations a NULL object is considered to be a member of any type.
>
> The cast macros are intended in part to verify that the object exists
> and is non-NULL, there's no point in using them for NULL objects (you
> can't check the type of NULL anyhow).
The GTK_IS_FOO() checks are meant to verify that the object exists and
is valid.
The cast macros are just meant to be a safe versions of '(GtkFoo*)pointer'
that warn for invalid casts between types. But assigning
NULL to a GtkFoo * is perfectly valid so t would make sense to me if
they passed through NULL transparently.
No code can be depending on the fact they _don't_ do that now,
so it seems like a safe change to me.
I'd actually be in favor of making the change, though perhaps I'm
forgetting some reason why it would be a bad idea.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]