如何在/usr/include/stdio.h中使用"#define stdin stdin"?

Bum*_*mzy 0 c stdio

在/usr/include/stdio.h中

/* C89/C99 say they're macros.  Make them happy.  */
#define stdin stdin
#define stdout stdout
#define stderr stderr
Run Code Online (Sandbox Code Playgroud)

这应该怎么样?

Jon*_*ler 5

关键点是,一旦扩展了宏,它就不会在替换文本中再次替换.这意味着当预处理器出现stderr 时:

fprintf(stderr, "Usage: %s file [...]\n", argv[0]);
Run Code Online (Sandbox Code Playgroud)

它将stderr令牌替换为stderr,然后重新扫描替换文本,但stderr不再符合扩展条件,因此文本仍然存在stderr.