P99
Modules | Defines
Generic type expressions
Emulating features of C11
+ Collaboration diagram for Generic type expressions:

Modules

 Generic identification of families of types or values

Defines

#define P99_DECLARE_INLINE_EXPRESSION(EXT, BASE, EXP,...)
 Declare an inline function of basename BASE for expression EXP, applied to the builtin type EXT.
#define P99_DECLARE_INLINE_EXPRESSIONS(NEPL,...)
 Declare a whole bunch of inline functions of basename BASE for expression EXP, applied to the builtin types as given in the argument list.
#define P99_GEN_ABS(A)   P99_GEN_EXPR(abs, ((A) >= 0) ? (A) : -(A), P99_STD_REAL_EXTS)(A)
#define P99_GEN_EXPR(BASE, EXPR,...)
 Produce a type generic expression that can be used as if it were an inline function.
#define P99_GEN_MAX(A, B)
#define P99_GEN_MIN(A, B)
#define P99_GEN_SIN(A)   P99_GEN_EXPR(sin, (A), P99_STD_FLOATING_EXTS)(A)
 Type generic macro to compute the sine of A.
#define P99_GENERIC(...)
 Type generic expression in anticipation of C11 _Generic.
#define P99_GENERIC_LIT(...)
 For each generic choice return a compound literal of the chosen type.
#define P99_GENERIC_SIZE(UI,...)
 Similar to P99_GENERIC but the choice is not according to the type of the expression UI but to its unsigned value.
#define P99_GENERIC_SIZE_LIT(UI,...)
 Similar to P99_GENERIC_SIZE but returns a compound literal of the chosen type.
#define P99_TYPED_TERN(COND, YES, NO)
 A compile time ternary operator that is analogous to COND ? YES : NO that keeps the type of the chosen expression.

Detailed Description

C11 provides a new feature to write template-like expressions with the macro preprocessor, _Generic. Here we provide some tools that emulate this feature by means of gcc specific extensions.

See also:
P99_GENERIC
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines