[Gnome-print] class method checks ..



Hi,

On Thu, 27 Apr 2000, Lauris Kaplinski wrote:
> Plus:
> Are there any reason, gnome-print-xxx methods do not test the presence
> of applicable method, i.e.
>
> if (GNOME_PRINT_CONTEXT_CLASS (((GtkObject *) pc)->klass)->xxx)
>       GNOME_PRINT_CONTEXT_CLASS (((GtkObject *) pc)->klass)->xxx)(args)

        Since the PRINT_CONTEXT_CLASS does an expensive type
check it would be preferably to bloat the code to:

        GnomePrintContextClass *klass = GNOME_PRINT_CONTEXT_CLASS
                                            ((GTK_OBJECT (pc))->klass);
        if (klass->xxx)
                klass->xxx (args);
        else
                g_warning ("Mega serious error in context '%s'",
                           gtk_type_name (klass->parent_class.type));

> I can imagine context not implementing many methods (plotters and
cutters
> for example), and it seems unnecessary to fill such classes with empty
> functions simply to avoid segfaults.

        I'm really not convinced that it is a good idea to allow NULL
pointers in the context's class data.

        Regards,

                Michael.

-- 
 mmeeks@gnu.org  <><, Pseudo Engineer, itinerant idiot





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