-
-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Labels
Description
__VA_OPT__ is a very useful feature.
Implementations enable it across all std modes (though nominally C++20 / C23).
It ousts non-standard use of the 'comma eating' __VA_ARGS__ extension.
There's no feature-test macro but it's detectable using a snippet from SO
#define VA_ARG1(A0,A1,...) A1
#define VA_EMPTY(...) VA_ARG1(__VA_OPT__(,)0,1,) // (Detects __VA_OPT__)
// VA_EMPTY(?) is true if __VA_OPT__ is supported
The idea to use #ifdef __VA_OPT__ for detection was considered but dropped -
see Richard Smith's comment here https://reviews.llvm.org/D91913#2526276
It seems ok to enable by default and disable via a commandline flag.
ostr00000