Date: Mon, 26 Aug 2024 11:24:59 -0700
On Monday 26 August 2024 11:08:48 GMT-7 Jeremy Rifkin via Std-Proposals wrote:
> > Is overflow anything that happens in reality, ever?
>
> Not that I know of, but I will ask some folks I know who spend more
> time stress testing the preprocessor than I. I agree that __COUNTER__
> overflow should basically never happen and if it did it would be the
> least of your problems.
Because it is the preprocessor, it's not that difficult to trigger it.
- A.h has 2048 uses of __COUNTER__ and no #include guard
- B.h includes A.h 2048 times
- C.cpp includes B.h 1024 times
This is unlikely, but not impossible.
It's also easily fixed by saying the counter is an intmax_t.
> > Is overflow anything that happens in reality, ever?
>
> Not that I know of, but I will ask some folks I know who spend more
> time stress testing the preprocessor than I. I agree that __COUNTER__
> overflow should basically never happen and if it did it would be the
> least of your problems.
Because it is the preprocessor, it's not that difficult to trigger it.
- A.h has 2048 uses of __COUNTER__ and no #include guard
- B.h includes A.h 2048 times
- C.cpp includes B.h 1024 times
This is unlikely, but not impossible.
It's also easily fixed by saying the counter is an intmax_t.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel DCAI Platform & System Engineering
Received on 2024-08-26 18:25:02