I was wondering, how is this done: when you pass the name of a function to a macro and it will call that function when it needs to, like this line of code:
GTK_SIGNAL_FUCN(eventFunction);
How does this work/how can I do this myself?
I was wondering, how is this done: when you pass the name of a function to a macro and it will call that function when it needs to, like this line of code:
GTK_SIGNAL_FUCN(eventFunction);
How does this work/how can I do this myself?
you make me rery ascared
Maybe something like this.Code:#include <stdio.h> #define A(x) (x)() #define B(x,y) (x)(y) void foo(void) { puts("Hello world"); } void bar(void) { puts("Goodbye cruel world"); } void baz(const char *s) { puts(s); } int main(void) { A(foo); A(bar); B(baz, "Hello again"); return 0; } /* my output Hello world Goodbye cruel world Hello again */
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
Thank you!
you make me rery ascared
If it is a macro, you should be able to find it in the relevant .h file and see for yourself.Originally posted by techrolla
I was wondering, how is this done: when you pass the name of a function to a macro and it will call that function when it needs to, like this line of code:
GTK_SIGNAL_FUCN(eventFunction);
How does this work/how can I do this myself?
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
My compiler doesn't seem to have "relevant.h"...Originally posted by Hammer
If it is a macro, you should be able to find it in the relevant .h file and see for yourself.
Quzah.
Hope is the first step on the road to disappointment.
Perhaps he meant revelation.h, it's where you'll find the answers to all of C's dark mysteries
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.