[Development] API style guide: scoped enum or not?
Allan Sandfeld Jensen
kde at carewolf.com
Wed Jun 14 21:49:22 CEST 2023
On Mittwoch, 14. Juni 2023 17:48:27 CEST Thiago Macieira wrote:
> On Wednesday, 14 June 2023 08:35:16 PDT Marc Mutz via Development wrote:
> > >>> B) new enums MUST be scoped, also when nested in classes¹²
> > >>
> > >> -1 Disagree
> > >
> > > -1 Disagree
> >
> > Ok. But _why_? (Q to both)
>
> I'm inclined to agree with (B), so I'd like to understand the objections.
As discussed earlier. Better naming in many cases until we can depend on
C++20 in API. I disagree with designing API for standards we are not yet
allowed to use. And there are a few rare cases with flags or other composite
value types, where the implicit casting is desirable. I wouldn't mind saying
scoped enums are the preferred default, and any unscoped enum needs to be
justified in the commit message, but I would hate to ban them out right.
Best regards
Allan
More information about the Development
mailing list