Menu

VarArgs

Cyder

VarArgs

Config: #define TPP_CONFIG_HAVE___VA_ARGS__ 0/1
Check: #if __has_feature(tpp_va_args) || __has_extension(tpp_va_args)
Function: tpp.c: _TPPLexer_CreateExpandedMacroFunction

Tpp allows macros to be defined with variadic arguments. See the syntax showcase below for detail.
The __VA_ARGS__ Identifier may not be used as parameter for functions

Hint: As fallback for invalid macro function calls, tpp always considers every function as a variadic function, but will only utter a too many arguments warning, if the function isn't declared as variadic.

#define v_args(func,...) func(__VA_ARGS__)

// NOTE: The following line will not yield a warning
//       due to the relaxed argument rules of TPP (s.a. The page for Macros)
v_args()          // Expands to [(][)]
v_args(foo)       // Expands to [foo][(][)]
v_args(foo,10)    // Expands to [foo][(][10][)]
v_args(foo,10,20) // Expands to [foo][(][10][,][20][)]

s.a. [Macros]


Related

Wiki: Macros

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.