繁体   English   中英

这个宏在函数声明中的作用是什么?

[英]What is the role of this macro in function declaration?

我已下载了一些库,它按以下方式声明了这些函数:

#if !defined(__ANSI_PROTO)
#if defined(_WIN32) || defined(__STDC__) || defined(__cplusplus)
#  define __ANSI_PROTO(x)       x
#else
#  define __ANSI_PROTO(x)       ()
#endif
#endif

int httpdAddVariable __ANSI_PROTO((httpd*,char*, char*));

这里__ANSI_PROTO的作用是__ANSI_PROTO 为什么最好简单地声明为

int httpdAddVariable (httpd*,char*, char*);

前ANSI C不支持这个:

int httpdAddVariable (httpd*,char*, char*);

它只支持这个:

int httpdAddVariable (); /* = arguments unspecified*/

这就是宏的作用。 如果它检测到原型支持,它会将参数类型粘贴到声明中; 否则,它只是粘贴()

暂无
暂无

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

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