Date: Fri, 23 Aug 2024 10:06:05 +0200
On 23/08/2024 05.43, Tiago Freire via Std-Proposals wrote:
> If there was a mechanism to reset the counter, like
> #pragma counter set 0
> People could use that in order to make the behavior deterministic.
>
>
> To be fair I have never used __COUNTER__ and I don't I see myself ever using it, because it is not at all all that useful, or predictable.
>
> There's nothing wrong with standardizing existing practice. The fact that it is so widespread is a good argument as to why it should be standard. If we rely on it, it is good to write it down as part of the de facto standard.
Right, so let's just do that.
> But the problem of just standardizing current practice is that sometimes there might be a better solution, and we might miss out on a much better "could have been" because we were to focus on "what it is right now".
Standardizing the simple __COUNTER__ now does not preclude investigating and
offering a better solution later. The __COUNTER__ feature of existing
implementations is likely not going away either way.
And yes, macros don't play well with the ODR (see the "assert" macro),
but that's just the way the preprocessor interacts with the rest of
the language.
Jens
> If there was a mechanism to reset the counter, like
> #pragma counter set 0
> People could use that in order to make the behavior deterministic.
>
>
> To be fair I have never used __COUNTER__ and I don't I see myself ever using it, because it is not at all all that useful, or predictable.
>
> There's nothing wrong with standardizing existing practice. The fact that it is so widespread is a good argument as to why it should be standard. If we rely on it, it is good to write it down as part of the de facto standard.
Right, so let's just do that.
> But the problem of just standardizing current practice is that sometimes there might be a better solution, and we might miss out on a much better "could have been" because we were to focus on "what it is right now".
Standardizing the simple __COUNTER__ now does not preclude investigating and
offering a better solution later. The __COUNTER__ feature of existing
implementations is likely not going away either way.
And yes, macros don't play well with the ODR (see the "assert" macro),
but that's just the way the preprocessor interacts with the rest of
the language.
Jens
Received on 2024-08-23 08:06:14