"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 <development-boun...@qt-project.org> on behalf of Tor Arne Vestbø via Development <development@qt-project.org> Sent: Wednesday, May 3, 2023 7:39 PM To: Macieira, Thiago Cc: development@qt-project.org Subject: Re: [Development] API style guide: scoped enum or not? On 3 May 2023, at 19:22, Thiago Macieira <thiago.macie...@intel.com> 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 Development@qt-project.org https://lists.qt-project.org/listinfo/development