C++ Logo

std-proposals

Advanced search

Re: [std-proposals] __COUNTER__

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Fri, 23 Aug 2024 11:09:39 +0200
czw., 22 sie 2024 o 17:23 René Ferdinand Rivera Morell via
Std-Proposals <std-proposals_at_[hidden]> napisał(a):
>
> On Thu, Aug 22, 2024 at 10:00 AM Mike Reed via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > Given that nearly every use case is to produce a unique identifier, surely the last thing you want overflow to do is silently wrap to zero. I would expect the standard to mandate that overflow forces a compile error.
>
> Given that.. It would be more useful to standardize some form of
> __UUID__ that matches the current __COUNTER__ use cases.
>

I think we have XY problem here, why do I even need `__COUNTER__` in
my C++ code?
Unique local variable? Soon we will have `_`.
Unique global variable? Add new keywords that will be placeholder for
name like `__unique_name__`.

There is any other case where I would use `__COUNTER__`?

>
> --
> -- René Ferdinand Rivera Morell
> -- Don't Assume Anything -- No Supone Nada
> -- Robot Dreams - http://robot-dreams.net
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2024-08-23 09:09:49