Re: Warning fix



On Fri, Jun 01, 2001 at 11:41:38PM -0400, Pavel Roskin wrote:
> Hi, Owen!
> 
> Thank you for prompt reply!
> 
> > > Either compare with 0 or cast it to (void *). The same applies to
> > > GTK_IS_OBJECT_CLASS.
> >
> > Err, GTK_IS_FOO() tests if a particular pointer is a GtkFoo.
> > There is absolutely no chance that an integer is a pointer to
> > a GtkFoo, so calling GTK_IS_FOO() on an integer is just an error.
> 
> Ok, I thought that GTK_OBJECT is supposed to make GtkObject from anything,
> not just from any pointer.

No, GTK_OBJECT is just like a cast to GtkObject* except it checks that what you give it actually is a GtkObject. It doesn't make anything.

> > I think the compiler is simply catching a bug in your code.
> 
> It's not a bug, it's a bad design. I added cast to (void *) inside call to
> GTK_OBJECT - the warning is gone.

Because if you put enough casts in your program (or gtk) so the compiler doesn't complain anymore, that means your program is free of bugs, right?




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