Re: callback function without arguments



On Tue, 2003-05-06 at 01:09, Shiraz Baig wrote:
> I have defined a callback function for "clicking" of a
> button. I have not used the normal form of 
> 
>    callback(GtkWidget *widget, gpointer data).
> 
> Instead, I have used a callback without any arugments.
> (See the example given below).
> 
> My question is 
> 
> "Is there anything wrong in doing so, when I do not
> need to dereference the widget or the data?"

GTK+ relies on this ability in various places internally
and it is quite safe on any machine you are likely to
ever run on. (Though it isn't guaranteed by the C standard.)

Regards,
                                 Owen

[
What you can't do is use a callback with *more* arguments
than it is called with, even if you don't reference
the extra arguments. This will break various assumptions 
used by the compiler.
]





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