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:
It only supported this:
So that's what the macro does. It pastes the argument types into the declaration if it detects prototype support; otherwise, it just pastes
()
.