C++ Logo

std-proposals

Advanced search

Re: [std-proposals] D4040R0 Case ranges

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Fri, 27 Feb 2026 14:05:37 +0000
On Fri, 27 Feb 2026 at 12:12, Jan Schultke <janschultke_at_[hidden]>
wrote:

> "Empty case ranges such as case -1 ... 0 are valid, but recommended to be
>> diagnosed. "
>>
>> Why is that an empty range?
>>
>
> Because I'm an idiot and meant to write 0 ... -1.
>

Ah, that makes more sense. I was re-checking my understanding (and
re-reading the GCC docs) that the range is inclusive of both values, but
even for 0 ... 0 that would still not be empty.



>
> Re the "A noteworthy quirk of the C2y feature" paragraph, that was
>> documented decades before it got into C2y:
>> https://gcc.gnu.org/onlinedocs/gcc/Case-Ranges.html
>> It might be worth linking to that page for the implementation experience
>> talking about the extension.
>
>
> Thanks, added a link, though not in the implementation experience section.
>

Thanks.

Received on 2026-02-27 14:05:53