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

Thiago Macieira thiago.macieira at intel.com
Thu May 4 00:17:03 CEST 2023


On Wednesday, 3 May 2023 10:51:18 PDT Jaroslaw Kobus via Development wrote:
> "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.

Hello Jarek

That's fair, but that requires a separate scope from the class itself. That 
alone may be a reason not to do so, and instead just declare the enum inside 
the class, as our current practice dictates, with the choice of plain enum or 
enum class.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20230503/df9b39d8/attachment-0001.bin>


More information about the Development mailing list