Hi Thiago

This is introducing dependencies on code which makes dependency breaking much 
harder. I very often need an enumeration in an interface but not the class 
itself. There are ways to get around that but it makes TDD harder if Qt is 
involved.

________________________________
From: Development <development-boun...@qt-project.org> on behalf of Thiago 
Macieira <thiago.macie...@intel.com>
Sent: Thursday, May 4, 2023 0:17
To: development@qt-project.org <development@qt-project.org>
Subject: Re: [Development] API style guide: scoped enum or not?

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
-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to