◆ P99_C

#define P99_C (   T,
)    ((T)+(X))

Generate an integer expression of type T and value X.

This macro is suitable for use in preprocessor conditionals, provided X evaluates to an integer constant.

Beware that the type information T is simply ignored by the preprocessor because its arithmetic is done with types intmax_t or uintmax_t. If you want to be sure that it is used as uintmax_t suffix the constant X with an "u" or "U".
Don't use this to perform bit-complement arithmetic in the preprocessor, since uintmax_t might have more bits than T, the result might not be what you expect.
Tmust be a type identifier, just one word that represents a type.
Xcould be any integer expression that is allowed in the same context. It is an error for X to evaluate to a pointer value.

The macro itself uses a dirty trick. In preprocessor context of conditional evaluation the T in the expansion is just an identifier that is unknown to the preprocessor and it is thus replaced by 0. The + sign is thus a binary plus.

In program context (T) is interpreted as a cast. The + sign is thus a prefix to the integer expression. This results in an error when an attempt is made to use this with a pointer value.

Definition at line 302 of file p99_int.h.