Re: Overhead of type casting when using GObject system



On Sat, Feb 09, 2013 at 10:53:25AM +0100, Lanoxx wrote:

> So if in C if write this:
> GtkGrid* grid = gtk_grid_new();
> GtkWidget* widget = GTK_WIDGET(grid);
> 
> then this creates more overhead then when in Java I write this:
> JTabel tabel = new JTabel();
> Object object = tabel; // No cast required.

gtk_grid_new() actually returns a GtkWidget*, but otherwise you're
right.

However those cast checks can be disabled at compile time removing the
overhead, so GTK_WIDGET(foo) would be equivalent to (GtkWidget *) foo.

Berto


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