( * (void (*) ()) 0) ();
Float*PF; The implication of this statement is that*PF is a floating-point number, which means that PF is a pointer to a floating-point number. float*g (), (*h) (); Express*g () and (*h) () are floating-point expressions. Because () The binding priority is higher than *,*g () is the *(g ()): G is a function in which the return value type is a pointer to a floating-point number. Similarly, you can conclude that H is a function pointer, and that the return value of the function that H points to is a floating-point type. float(*h) (); Indicates that H is a pointer to a function that returns a value of floating-point type, so (float(*) ()) represents a type conversion character that refers to a pointer to a function that returns a floating-point type . The first step is to assume that the variable FP is a function pointer , so how do you invoke the function that the FP points to? The method is called as follows: ( *FP) (); Because FP is a function pointer,*FP is the function that the pointer points toSo(* FP) () is the way the function is called . An expression (*FP) (), the parentheses on both sides of the *fp are important because the function operator () takes precedence over the single-mesh operator *. If there are no brackets on both sides of the *FP, then *FP () actually(FP ()) means exactly the same. (*0) () is not valid because the operator* You must have a pointer to do the operand. And this pointer should also be a function pointer, so that the operator *The result of the action can be called as a function. Therefore, a 0 type conversion must be made in the above, and the converted type can be roughly described as "a pointer to a function that returns a value of type void." Therefore, the conversion of constant 0 to "pointer to a function with a return value of void" can be written like this: (void(*) ())0of course, we use typedef to solve this problem can be expressed more clearly:12typedefvoid(*FP) ();//declaring a function pointer type FP(* (FP)0)();//the conversion of 0 to a function pointer type, * (function pointer) is the function itself,
A detailed C + + function pointer Declaration (* (Void (*) ()) 0) ();