"enum class" has one advantage over "enum" inside a "class" : you may forward 
declare the "enum class", while the other not. That's quite often case that 
your header must include the other header just because you use the "enum" in 
"class" in your API and nothing more.

Jarek

________________________________________
From: Development <[email protected]> on behalf of Tor Arne 
Vestbø via Development <[email protected]>
Sent: Wednesday, May 3, 2023 7:39 PM
To: Macieira, Thiago
Cc: [email protected]
Subject: Re: [Development] API style guide: scoped enum or not?



On 3 May 2023, at 19:22, Thiago Macieira <[email protected]> wrote:

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.

Agreed, and this is also what our current API design guide says:

<https://wiki.qt.io/API_Design_Principles#Naming_Enum_Types_and_Values>
API Design Principles - Qt 
Wiki<https://wiki.qt.io/API_Design_Principles#Naming_Enum_Types_and_Values>
wiki.qt.io<https://wiki.qt.io/API_Design_Principles#Naming_Enum_Types_and_Values>
[favicon.ico]<https://wiki.qt.io/API_Design_Principles#Naming_Enum_Types_and_Values>


tor arne
-- 
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to