C++ Logo

std-proposals

Advanced search

Re: a few small ideas

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Thu, 19 Aug 2021 22:43:04 +0200
On 19/08/2021 22.25, Baruch Burstein via Std-Proposals wrote:
> Hi,
> I had a few thoughts for small additions to the language and I wanted to hear if these ideas had already been suggested in some form or other and what people thought of them.
>
> 1. bit flag enums - have a way to mark an enum as a bit flag, so that the default assigned values would be 0x01, 0x02, 0x04, 0x08, etc.

Not that I'm aware of.

> 2. conditional return - This would really be just syntactic sugar, but instead of
> if (retVal == FAIL)
> return retVal;
> have something like
> return_if (retVal == FAIL) retVal;
> it seems cleaner to me.

It's a one-token saving and adds another control-flow statement.

This needs a lot more motivation and rationale and arguing
for a good enough cost/benefit ratio than "seems cleaner"
(which I disagree with).

Jens

Received on 2021-08-19 15:43:10