[Development] API style guide: scoped enum or not?

Allan Sandfeld Jensen kde at carewolf.com
Wed Jun 14 16:20:00 CEST 2023


On Mittwoch, 14. Juni 2023 14:59:40 CEST Marc Mutz via Development wrote:
> On 02.05.23 10:58, Volker Hilsheimer via Development wrote:
> > During the header review, but also in API discussions leading up to it, we
> > had a few cases where it would have helped if we had clearer guidelines
> > about when to use scoped enums, and when not.
> Was there some consensus here? We're discussing this _again_ in the 6.6
> review...
> 
> Let me propose the following, separate issues, so we have something
> concrete to +1 or -1:
> 
> [All capitalized words have the meaning of IETF RFCs]
> 
> A) new enums MUST have an explicit underlying type¹²
+1 Sure

> 
> B) new enums MUST be scoped, also when nested in classes¹²
-1 Disagree

> 
> C) scoped enums SHOULD NOT repeat (part of) an enum's type name in the
> enumerators²
> 
+1 Agree, and if you find you do repeat the type name in an unscoped enum it 
probably should be scoped. But isn't this already in our style guide?

Best regards
Allan





More information about the Development mailing list