C23 brings a new macro feature that eases programming with variadic
macros a lot. Before it has been a challenge to detect if a ...
argument was actually empty or contained at least one real
token. This feature was introduced into C23 by a paper by Thomas Köppe
“Comma omission and comma deletion”
A similar feature had already been integrated to C++20 before.
As an example for the feature, suppose we want to augment calls to fprintf
such that two
types of problems are detected:
- If there is only a format argument and no others, we want to use
fputs
to avoid scanning the format at execution time. - If there are more than one arguments, it should be assured that the format is a string literal, such that the contents can be parsed at compile time.