C++ Logo

std-proposals

Advanced search

Re: More flexible break statements.

From: Jake Arkinstall <jake.arkinstall_at_[hidden]>
Date: Sat, 17 Aug 2019 09:35:41 +0100
On Fri, 16 Aug 2019, 23:37 Hyman Rosen via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> This is so obviously the right thing to do that I'm confident that the
> design of C++ is in the wrong hands, and has been for a long time.
> There is nothing to be done unless an insurrection of people fed up
> with the status quo join the committee and change its direction.
>

It's a goto-esque solution to a problem that already has a modern solution,
as Arthur demonstrates, which is more readable and doesn't change behaviour
when used in different contexts.

The idea with the switch seems, at first, nifty. But to me it highlights
bad use of switch statements (though to me, any fall through is a bad use
of a switch statement), especially when if statements are clearer and less
like spaghetti.

I support the committee's general movement towards getting rid of the need
to use macros over inventing new hacky idioms to support their use further.
To be fair, at this point all they need to do is support auto NSDMI:

auto make_something(){
  auto foo = ...;
   ...
   return foo;
}
struct S{
     // no need for decltype:
     auto x = make_something();
};

And I can honestly say that I'd have zero uses for macros these days.

Received on 2019-08-17 03:37:52