The (&fp)(int, mylong)
part represents a reference to a function. It is not recommended that programmers use functions in typedef
for the very reason you're asking this question. It confuses other people looking at the code.
I'm guessing they use the typedef
in something like this:
typedef unsigned long mylong; //for completeness
typedef int (&fp)(int, mylong);
int example(int param1, mylong param2);
int main() {
fp fp_function = example;
int x = fp_function(0, 1);
return 0;
}
int example(int param1, mylong param2) {
// does stuff here and returns reference
int x = param1;
return x;
}
Edited in accordance with Brian's comment:
int(&name)(...)
is a function reference called name
(the function returns an int)
int &name(...)
is a function called name
returning a reference to an int
A reference to a function which returns an int
reference would look something like this: typedef int &(&fp)(int, mylong)
(this compiles in a program, but the behaviour is untested).