Re: Warning fix
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list gnome org
- Cc: Pavel Roskin <proski gnu org>
- Subject: Re: Warning fix
- Date: 01 Jun 2001 22:29:16 -0400
Pavel Roskin <proski gnu org> writes:
> Hello!
>
> There is a minor bug in version 1.2.10. The definition of GTK_IS_OBJECT in
> gtk/gtkobject.h contains:
>
> (object) != NULL
>
> This causes a warning (comparison between pointer and integer) with
> gcc-2.96 (RedHat 7.1) when an integer is passed to GTK_OBJECT. GTK_OBJECT
> takes case to cast the argument, but GTK_IS_OBJECT doesn't.
>
> 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.
Most likely it will cause a segfault, because the tests will
try to interpret the integer as a pointer.
(In fact, if calling GTK_IS_OBJECT is legal at all, it will
return TRUE, since you can only call GTK_IS_OBJECT on objects
inheriting from GtkObject.)
I think the compiler is simply catching a bug in your code.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]