#define P99_FORMAT (   ...)
(P99_IF_LT(P99_NARG(__VA_ARGS__), 2) \
(__VA_ARGS__, 0) \
(__VA_ARGS__), \
a string with a printable representation of the first argument. This string is local to the function and should not be exported from there.

Only use this with the printf family of functions as follows:

printf("My values are %s and %s\n", P99_FORMAT(a), P99_FORMAT(b));

that is the only printf format you should use yourself is "%s" for the position and then P99_FORMAT is doing the rest, namely prints the argument according to its type.

This supports all scalar types, including _Bool and the complex types (if there are any).
For many of the types there are alternate output formats that can be chosen by adding a second parameter (default 0). The alternate formats are hexadecimal (for unsigned and floating types) and additionally octal representations (for unsigned types).
This uses P99_GENERIC, so obviously it will only work if the rudimentary support for type generic macros is available.
argument 0 maybe evaluated several times for its type but only once for its value
argument 2 maybe evaluated several times for its type but only once for its value

Definition at line 1417 of file p99_generic.h.

#define P99_NARG(...)
Return the length of the variable length argument list, where an empty argument list is considered to...
Definition: p99_args.h:117
#define P99_IF_LT(A, B)
Test two decimal numbers A and B for whether A is strictly less than B.
Definition: p99_if.h:120
#define P99_FORMAT(...)
Definition: p99_generic.h:1417