Open willwray opened 1 year ago
__VA_OPT__ is a very useful feature.
__VA_OPT__
Implementations enable it across all std modes (though nominally C++20 / C23). It ousts non-standard use of the 'comma eating' __VA_ARGS__ extension.
__VA_ARGS__
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
#ifdef __VA_OPT__
It seems ok to enable by default and disable via a commandline flag.
C++ draft link, includes useful examples for testing purposes https://eel.is/c++draft/cpp.subst#nt:va-opt-replacement
__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
The idea to use
#ifdef __VA_OPT__
for detection was considered but dropped - see Richard Smith's comment here https://reviews.llvm.org/D91913#2526276It seems ok to enable by default and disable via a commandline flag.