Skip to content

Feature request: consider support for __VA_OPT__Β #78

@willwray

Description

@willwray

__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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions