Bruce
Bruce

Reputation: 35285

What does this pointer notation mean?

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

*START = &fun_foo();

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

Upvotes: 1

Views: 140

Answers (2)

Andrew Cooper
Andrew Cooper

Reputation: 32596

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.

Upvotes: 3

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.

Upvotes: 1

Related Questions