C++ Logo

std-proposals

Advanced search

Re: [std-proposals] __COUNTER__

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Thu, 22 Aug 2024 15:32:26 +0000
I don't think a counter by itself is all that useful without the means to control said counter. Or maybe have different counter categories to count different things.

I'm not too worried about overflow behavior if you make it size_t, it you are in a situation where you could overflow it, the fact that it could overflow would be the least of your problems.
________________________________
From: Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf of Mike Reed via Std-Proposals <std-proposals_at_[hidden]>
Sent: Thursday, August 22, 2024 5:00:22 PM
To: Jason McKesson via Std-Proposals <std-proposals_at_[hidden]>
Cc: Mike Reed <mike_at_[hidden]>
Subject: Re: [std-proposals] __COUNTER__

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.

On Thu, 22 Aug 2024, 16:39 Jeremy Rifkin via Std-Proposals, <std-proposals_at_[hidden]<mailto:std-proposals_at_[hidden]>> wrote:
Hello,
I've drafted a proposal to standardize __COUNTER__: https://jeremy-rifkin.github.io/cpp-proposals/drafts/counter_initial_draft.html.

I welcome any comments and thoughts,
Jeremy
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]<mailto:Std-Proposals_at_[hidden]>
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2024-08-22 15:33:13