C++ Logo

sg10

Advanced search

Re: [SG10] [wg14/wg21 liaison] Feature test macro for P0306 (__VA_OPT__)

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Thu, 28 Jan 2021 12:22:17 +0200
On Thu, 28 Jan 2021 at 12:18, Jonathan Wakely <cxx_at_[hidden]> wrote:
>> > The #ifdef __VA_OPT__ solution was my first thought, it's unfortunate we forbid it. If we can't have that then I think we do need a feature test macro. The voodoo above will make most developers wish they were using Rust.
>>
>> If they're using VA_OPT, the cause is already lost.
>
>
> And even if we add a feature test macro now (or allow #ifdef __VA_OPT__) there are still compilers that will reject it with an error (e.g. with -pedantic-errors in pre-C++20 modes). So maybe the ship has sailed and support this feature is already "untestable". You just have to know if your code can use it or not.

Well, with the feature-test macro we'll get sane feature detection
going forward. You just might not get VA_OPT even though
it's really available. With trying to allow #ifdef __VA_OPT, sure,
we'd have this problem, because you don't know whether
you can do the ifdef. :D

So, this problem can be solved without a feature-test macro, but those
solutions are more hideous than is reasonable, if you
ask me.

Received on 2021-01-28 04:22:30