C++ Logo

std-proposals

Advanced search

Re: [std-proposals] D4040R0 Case ranges

From: Halalaluyafail3 <luigighiron_at_[hidden]>
Date: Fri, 27 Feb 2026 12:32:26 -0500
> if (c >= 'a' && c <= 'z')

This relies on ASCII being used, which I think should be mentioned. Somewhat
related, but C2Y is standardizing sequential hex digits so case'a'...'f' and
case'A'...'F' will work regardless of the character set used.

> case 0...9 is not valid because 0. and .9 are parsed as floating-point-literals, with one . between.

0...9 is parsed as one pp-number, rather than three tokens.

On Fri, Feb 27, 2026 at 6:17 AM Jan Schultke via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Hi,
>
> https://isocpp.org/files/papers/D4040R0.html
>
> I am proposing to add case ranges to C++. For example, this lets you write:
>
> switch (next_char) {
> case '0' ... '9': // ...
> }
>
> Find all the details at the link. Happy to hear any thoughts on the matter.
>
>
> Jan
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2026-02-27 17:35:53