[gst-devel] Fwd: Re: no more GTK_CHECK_CAST in newly written code?
Kang Jeong-Hee
Keizi at mail.co.kr
Tue Apr 30 02:18:05 CEST 2002
On 2002.04.30 17:44 Sven Neumann wrote:
> Hi,
>
> Kang Jeong-Hee <Keizi at mail.co.kr> writes:
>
> > I've found gtktypeutils.h define GTK_CHECK_CAST with comment of
> > /* glib macro wrappers (compatibility) */.
> > is that meaning I'd better not to use SOME_CHECK_CAST, but to use directly G_TYPE_CHECK_INSTANCE_CAST?
> >
> > for example, GStreamer do not use GST_CHECK_CAST, refer directly to G_TYPE_...
> > """
> > #define GST_OBJECT_CAST(obj) ((GstObject*)(obj))
> > #define GST_OBJECT_CLASS_CAST(klass) ((GstObjectClass*)(klass))
> >
> > #ifdef GST_TYPE_PARANOID
> > # define GST_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_OBJECT, GstObject))
> > # define GST_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_OBJECT, GstObjectClass))
> > #else
> > # define GST_OBJECT GST_OBJECT_CAST
> > # define GST_OBJECT_CLASS GST_OBJECT_CLASS_CAST
> > #endif
> > """
> >
> > that form of definition is new GTK+-2.x stlye?
>
> Some of the macros changed their name since the object system is now
> independent from GTK+ and lives in GObject which is part of GLib.
> However this looks pretty much GStreamer-specific. Normally you'd
> write something like this:
>
> #define GIMP_TYPE_IMAGE (gimp_image_get_type ())
> #define GIMP_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_IMAGE, GimpImage))
> #define GIMP_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_IMAGE, GimpImageClass))
> #define GIMP_IS_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_IMAGE))
> #define GIMP_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_IMAGE))
> #define GIMP_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_IMAGE, GimpImageClass))
>
>
> I don't think it makes sense to introduce things like GST_TYPE_PARANOID
> to switch expensive type-checking casts on and off since the same effect
> can be achieved by using G_DISABLE_CHECKS as provided by Glib.
I think this is good point. what about this gst team?
(frankly I don't understand what is G_DISABLE_CHECKS this moment ;)
>
>
> Salut, Sven
> _______________________________________________
> gtk-list mailing list
> gtk-list at gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
>
More information about the gstreamer-devel
mailing list