C++ Logo


Advanced search

Re: [std-proposals] Switch on strings

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Sun, 26 Feb 2023 17:35:12 +0300
On 2/26/23 16:39, Arthur O'Dwyer via Std-Proposals wrote:
> (2) Political objection: `switch` sucks. It's a relic of C, like `goto`.
> Its semantics are confusing (fallthrough! Duff's Device!). It is quick
> to teach both because it is rarely used and because it is relatively
> simple. You seem to be proposing to make it (still rarely used but)
> relatively more complicated, thus forcing students to spend longer
> learning it... but why should we /want/ people to spend more time on
> `switch`? That time could be better spent elsewhere in the language.

You can't be serious about "rarely used". Sure, it's not as ubiquitous
as "if", but definitely not a rare beast.

Received on 2023-02-26 14:35:18