C++ Logo

std-proposals

Advanced search

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

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Mon, 26 Aug 2024 13:38:32 +0300
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.

Received on 2024-08-26 10:38:39