Re: GTK_WINDOW(NULL) (WAS: more patches)



Dan Winship <danw ximian com> writes:

> On 02 Mar 2001 21:53:38 -0500, Owen Taylor wrote:
> > 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.
> 
> There's certainly code (in other libraries if not gtk itself) that
> assumes that
> 
>         g_return_if_fail (GTK_IS_FOO (bar));
> 
> is going to trap the case of "bar == NULL".
> 
> (I think the change *is* a good idea (I've used C-style casts instead of
> GTK-style to get around the NULL problem before too), but it's not 100%
> transparent.)

There was no proposal to change GTK_IS_FOO().

I suppose you could make an argument that:

 "GTK_FOO(a) should succeed if and only if GTK_IS_FOO(a)"

I don't think that's useful, however.

                                        Owen




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