Re: Why doesn't GTK+...




"Vomjom" <vomjom@earthlink.net> writes:

> GTK+ allows one argument for functions like
> gtk_signal_connect()... why doesn't it allow multiple arguments
> using ellipses (...) as an argument? This could fit in many places,
> such as gtk_slist_append(), allowing you to append more than one
> thing at a time.

This is impossible to do in a portable manner - while
having a gtk_signal_connect() variant that took an
arbitrary number of user data arguments is easy 
to do using varargs, the problem is writing code
that can call:

 void callback (GtkWidget *widget, gpointer data)

and 

 void callback (GtkWidget *widget, gpointer data1, 
                gpointer data2)

and

 void callback (GtkWidget *widget, gpointer data, gpointer data2,
                gpointer data3)

and so forth.

To do that portably, you'd have to have one variant
of your calling function for each number of arguments.

There is a library called libffi out there that could
probably be used to do this - it has knowledge of
how the call stack works for various platforms.
But that would certainly make GTK+ harder to get
going and less portable than it is currently.

Regards,
                                        Owen




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