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

Marc Mutz marc.mutz at qt.io
Wed May 3 19:40:18 CEST 2023

On 03.05.23 19:22, Thiago Macieira wrote:
> On Wednesday, 3 May 2023 09:40:42 PDT Giuseppe D'Angelo via Development wrote:
>>   To me it's a no brainer: any new enumeration
>> added to Qt shall be an enum class.
> I'd say that any new enumeration in the Qt namespace should be enum class, but
> enums in classes may not be so if they're sufficiently descriptive already.

That's the wording we currently have, and I have two problems with that:

- it's subjective, which means we get to quarrel over every class-scope 
enum anew
- it completely ignores the point that scoped enums don't implicitly 
convert to underlying_type, which is a very welcome subtraction from 
C/C++'s infamous implicit conversion mess

So if it's a vote: +1 for all new enums being scoped and +1 for all old 
enums being made scoped come Qt 7.


Marc Mutz <marc.mutz at qt.io>
Principal Software Engineer

The Qt Company
Erich-Thilo-Str. 10 12489
Berlin, Germany

Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht Charlottenburg,
HRB 144331 B

More information about the Development mailing list