簡體   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