P99
Macros
Default arguments and types for functions

As a C++ like feature, this series of macros can be used to provide default arguments to functions and also to improve type safety for variadic functions. More...

+ Collaboration diagram for Default arguments and types for functions:

Macros

#define P99_CALL_DEFARG(NAME, M, ...)   NAME(__VA_ARGS__)
 Define a replacement macro for functions that can provide default arguments to the underlying real function. More...
 
#define P99_CALL_DEFARG_LIST(NAME, M, ...)   __VA_ARGS__
 Expand an argument list with default arguments. More...
 
#define P99_CALL_VA_ARG(NAME, M, T, ...)   NAME(__VA_ARGS__)
 Assure type safety for variadic functions. More...
 
#define P99_DECLARE_DEFARG(NAME, ...)
 Provide default arguments for macro NAME. More...
 
#define P99_DEFARG_DOCU(NAME)
 Provide a documentation section to a function defined with P99_CALL_DEFARG. More...
 
#define P99_DEFINE_DEFARG(NAME, ...)
 Define the symbols that are declared through a corresponding call P99_DECLARE_DEFARG. More...
 
#define P99_INSTANTIATE(RT, NAME, ...)   RT NAME(__VA_ARGS__)
 Instantiate an inline function. More...
 
#define P99_PROTOTYPE(...)
 Define the prototype of function NAME. More...
 

Detailed Description

As a C++ like feature, this series of macros can be used to provide default arguments to functions and also to improve type safety for variadic functions.

This goes in several parts.

Another feature that is provided here is a macro that allows you to prescribe a certain type to the arguments of a variadic function. In plain C these are dangerous, since C cannot guess the type that the implementation of the function expects. P99_CALL_VA_ARG may be used to overcome this problem.

pthread_mutex_init
#define pthread_mutex_init(...)
Default arguments for POSIX function pthread_mutex_init.
Definition: p99_posix_default.h:58
P99_PROTOTYPE
#define P99_PROTOTYPE(...)
Define the prototype of function NAME.
Definition: p99_defarg.h:197