为什么括号在函数指针声明中很重要?

Yee*_*Fei 5 c++ typedef function-pointers function-declaration

我不明白为什么接受以下声明:

typedef void    (*_tStandardDeclaration)(LPVOID);
Run Code Online (Sandbox Code Playgroud)

而以下不是:

typedef void    *_tDeclarationWithoutParenthesis(LPVOID);
typedef void*   _tAlternateDeclaration(LPVOID);
Run Code Online (Sandbox Code Playgroud)

我正在使用MSVC6(我知道它是过时的和非标准的,但它需要保持每年十亿的收入系统:/)

Mik*_*keP 12

默认情况下,指针符号绑定到类型,因此函数指针需要括号来指示指针实际上在名称上,而不是在返回类型上.


dan*_*n04 6

如果没有括号,则表示函数返回a void*,而不是返回函数的指针void.