为什么不能在 C++ 中将 putc() 实现为宏? (或者可以吗?)

Why can't putc() be implemented as a macro in C++? (Or can it?)

阅读 en.cppreference.com 关于 fputc()/putc() 的内容,我偶然发现了以下语句:

In C, putc() may be implemented as a macro, which is disallowed in C++.

这是真的吗?如果是这样,这是在哪里(在 C++ 标准中)声明的?

可能相关:

putc在C标准中被指定为一个函数:

7.19.7.8 The putc function

C 标准允许将任何 C 标准库函数实现为宏(仍然需要提供真正的函数实现,但如果在头文件中定义了宏,那就是将使用的):

7.1.4 Use of library functions

Any function declared in a header may be additionally implemented as a function-like macro

但 C++ 标准明确指出这些必须定义为函数:

17.4.1.2.6 Headers

Names that are defined as functions in C shall be defined as functions in the C++ Standard Library.

脚注明确说明不允许附加宏定义:

This disallows the practice, allowed in C, of providing a "masking macro" in addition to the function prototype. The only way to achieve equivalent "inline" behavior in C++ is to provide a definition as an extern inlin