C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Second draft of a __COUNTER__ proposal

From: Lénárd Szolnoki <cpp_at_[hidden]>
Date: Mon, 26 Aug 2024 11:46:44 +0100
On 26 August 2024 11:38:32 BST, Andrey Semashev via Std-Proposals <std-proposals_at_[hidden]> wrote:
>On 8/26/24 12:11, Jens Maurer wrote:
>>
>>
>> On 26/08/2024 10.44, Andrey Semashev via Std-Proposals wrote:
>>> On 8/26/24 11:43, Andrey Semashev wrote:
>>>> On 8/26/24 09:33, Christof Meerwald via Std-Proposals wrote:
>>>>>
>>>>> Does this really need a separate feature test macro when you can just
>>>>> test on __COUNTER__ itself?
>>>>
>>>> __COUNTER__ may be defined by user.
>>
>> No. See [lex.name] p3.1
>
>Reserved or not, a user is not prevented from using the name. A compiler
>that does not support __COUNTER__ will not prevent the user from
>defining the macro.
>
>>> ...or have non-standard semantics.
>>
>> Improbable, given the implementation experience we've seen here.
>
>Current compilers don't implement errors on overflow, so already not
>conforming to the proposal.
>
>> I'm in favor of not having a feature-test macro.
>
>If __COUNTER__ is standardized then I'm in favor of a feature macro.
>

FWIW I see no drawback of a feature macro. Are we running out of them?

Received on 2024-08-26 10:46:48