1
#define START ((void (**)(int)) 0x0fff)

*START = &fun_foo();

I haven't seen this before. What is happening here? Is void (**)(int) a function pointer?

Bruce
  • 33,927
  • 76
  • 174
  • 262

2 Answers2

3

void (**)(int) is a pointer to a pointer to a function that takes an int and returns nothing.

So START is apointer to a function pointer, and *START is the actual function pointer which is set to point to fun_foo.

Andrew Cooper
  • 32,176
  • 5
  • 81
  • 116
1

In your case, START is a pointer (located at the fixed address 0x0fff) to a function pointer.

But as I suggested in this answer, for readability reasons, you may want to use a typedef for the signature of that pointed function.

Community
  • 1
  • 1
Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547