Re: passing args
- From: Eric Monsler <eric_monsler radixwireless com>
- To: dsh8290 rit edu
- Cc: gtk-list <gtk-list gnome org>
- Subject: Re: passing args
- Date: Wed, 15 Nov 2000 13:38:39 -0800
D-Man wrote:
>
> I like to write functions such as function_prime as a macro because they are so simple. That way it doesn't take any runtime to call it.
>
> -D
>
I don't think that the macro approach works when specifying a function
as a callback. Does it?? If so, I would love to hear how, because that
would mean something is seriously broken in my understanding of the
pre-processor, compilation and linking process and the callback use of
function pointers.
I would expect that using:
#define function_prime(ARG) function(ARG->arg1,ARG->arg2)
will cause the line:
gtk_timeout_add(interval, function_prime, &data);
to be expanded to:
gtk_timeout_add(interval, function, &data);
and, when called, to have the effect of calling
function( ((type1 *)&data), ((type2 *)rand()) );
Where rand() is not really called of course, but represents some unknown
content of a register or stack location used to pass the second argument
of a function, when the call by pointer expects to be passing one
argument.
Eric
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]