Re: callback parameters



On Fri, 19 May 2000, Jeff Edwards wrote:

> Could someone please explain to me why it is reasonable to connect
> gtk_widget_destroy() to a button clicked signal, when
> gtk_widget_destroy() takes only one parameter?
> 
> As far as I can tell by reading the GTK+ source code, the callbacks for
> button clicked signals (and every signal, for that matter) _always_ get
> called with at least two arguments. Won't calling a function that
> expects only one argument potentially screw up the stack? Admittedly, it
> seems of work OK in actual practive, but is it really legitimate?

  It seems that all C compilers conform to de-facto standard of cleaning the
stack by the caller, and since the caller knows how much parameters were
pushed, all works fine. This de-facto standard seems to originate due to
C's support of functions with variable number of arguments like printf.
  Seems any CPU/compiler vendor understands that so systems for which this
technique will break do not exist (I hope).
 
> Thanks,
> Jeff Edwards

 Best regards,
  -Vlad





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