简体   繁体   English

在主体中定义name_fn的函数的C原型

[英]C prototype of a function with define name_fn in a body

Could you help me understand what the following piece of code means? 您能否帮助我理解以下代码的含义? Specifically, I do not understand what the effect of name_fn is. 具体来说,我不了解name_fn的作用。

    #define name_fn
    void name_fn Function(void);

The macro name_fn expands to nothing during pre-processing. 预处理期间宏name_fn扩展为空。 So the next line is same as 所以下一行与

void Function(void);

Empty #define is useful for compatibility, self documentation and/or mechanical checking. 空的#define可用于兼容性,自我记录和/或机械检查。

For example, in socket programming, you may encounter : 例如,在套接字编程中,您可能会遇到:

SOCKET WSAAPI
accept (IN SOCKET s,OUT struct sockaddr FAR* addr, OUT int FAR* addrlen );

Here IN and OUT are empty macros. INOUT是空宏。 They 他们

  1. Can be used to mechanically [ check ] the code. 可以用来机械地[检查]代码。
  2. Serve as a strong reminder on how the author intended use the parameters associated with them. 强烈提醒作者打算如何使用与之关联的参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM