C++ Logo

std-proposals

Advanced search

Re: [std-proposals] A proposal on default enum initialization

From: Andrew Tomazos <andrewtomazos_at_[hidden]>
Date: Sat, 25 Mar 2023 03:54:59 +1100
On Sat, Mar 25, 2023 at 1:32 AM Aleksej Penkov via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> *enum TestEnum {*
>
> * good = -100,*
>
> * bad = 200*
>
> *default:*
>
> * bad*
>
> *};*
>

I think the better syntax would be:

enum TestEnum {
    good = -100,
    default bad = 200
};

That way you're not unnecessarily repeating the identifier.

Received on 2023-03-24 16:55:12