C++ Logo

SG10

Advanced search

Subject: Re: [wg14/wg21 liaison] Feature test macro for P0306 (__VA_OPT__)
From: Barry Revzin (barry.revzin_at_[hidden])
Date: 2021-01-28 09:19:54


On Thu, Jan 28, 2021 at 4:12 AM Jonathan Wakely <cxx_at_[hidden]> wrote:

>
>
> On Wed, 27 Jan 2021 at 20:54, Barry Revzin via Liaison <
> liaison_at_[hidden]> wrote:
>
>> Eric Niebler actually asked this on StackOverflow a few years ago:
>> https://stackoverflow.com/q/48045470/2069064
>>
>> The accepted answer there is:
>>
>> #define PP_THIRD_ARG(a,b,c,...) c#define VA_OPT_SUPPORTED_I(...) PP_THIRD_ARG(__VA_OPT__(,),true,false,)#define VA_OPT_SUPPORTED VA_OPT_SUPPORTED_I(?)
>>
>>
> Who is going to remember that without having to look it up though?
>
> 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.
>

Yeah but isn't the purpose of StackOverflow's existence to copy and paste
code from it? Just need to remember how to google the question.

Barry



SG10 list run by sg10-owner@lists.isocpp.org