I have downloaded some library and it declares the functions the following way:
#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*));
What is the role of __ANSI_PROTO
here? Why it is preferred to declaring simply as
int httpdAddVariable (httpd*,char*, char*);
Pre-ANSI C didn't support this:
int httpdAddVariable (httpd*,char*, char*);
It only supported this:
int httpdAddVariable (); /* = arguments unspecified*/
So that's what the macro does. It pastes the argument types into the declaration if it detects prototype support; otherwise, it just pastes ()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With