Re: newbie question: connecting signals to callbacks



On Tuesday 02 November 2004 01:08, Neil Zanella wrote:

> I have a basic question which I would like to ask:
>
> The function prototype for gtk_main_quit() is:
>
> void gtk_main_quit(void);
>
> The GtkObject signal prototype for the "destroy" callback is:
>
> void user_function(GtkObject *object, gpointer user_data);
>
> Yet I can connect the two as follows:
>
> g_signal_connect(widget, "destroy", G_CALLBACK(gtk_main_quit), NULL);
>
> My question is, is it always legal to connect a signal to a function
> with less parameter arguments than those described in the API?

Yes, it's fine to call a function with more arguments than it takes (in C). 
Google for 'C calling convention' and 'caller clears stack' for details.

Cheers
 -Tim



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