`void f(void())` 是什么意思?

What does `void f(void())` mean?

考虑以下片段:

void f(void());

void() 作为参数类型到底是什么意思?
如果它是(可能是)函数指针或函数引用,它是合法代码吗?

据我所知,我不能将函数指针定义为:

void(f)() = &g;

为什么在处理函数的参数时要接受?

第一次遇到的时候迷惑了一段时间

我已经习惯了以下函数具有相同类型的事实:

void f(int[]);
void f(int*);

类似的情况适用于函数指针。

如工作草案dcl.fct中所述(强调我的):

The type of a function is determined using the following rules. [...] After determining the type of each parameter, any parameter of type “array of T” or of function type T is adjusted to be “pointer to T”. [...]

因此,以下函数:

void f(void());

具有相同类型的:

void f(void(*)());

因此下面的定义是相同的:

void f(void(g)());
void f(void(*g)());