char - returning a char *
(* - of pointers to *---v ^
(* - returning a pointer to *---v ^ v ^
x() - a function `x` --^ v ^ v ^
)[] - an array *---^ v ^
)(); - functions *--^
并查看https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.array-type,例如:
FPA_PFcvEvE
^ - function (
^ - returning pointer
^ - to an array [
>< - with no dimension expression
^ - separator, end of array ]
^ - of pointers
^ - to functions (
^ - returning char
^ - (void) functions that take no arguments
^ - separator, end of function )
^ - (void) it's a function that takes on arguments
^ - separator, end of function )
例子:
#include <iostream>
char return_a() { return 'a'; }
char return_b() { return 'b'; }
char return_c() { return 'c'; }
char (* array_of_funcs_that_return_char[3])() = {
return_a,
return_b,
return_c,
};
char (* (*pointer_to_array_of_funcs_that_return_char)[3])() = &array_of_funcs_that_return_char;
char ( * (* x() )[3] )() {
return pointer_to_array_of_funcs_that_return_char;
}
int main() {
std::cout << (*x())[1](); // outputs 'b'
}