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

Thiago Macieira thiago.macieira at intel.com
Fri May 5 08:10:34 CEST 2023


On Thursday, 4 May 2023 22:48:44 PDT Thiago Macieira wrote:
> On Thursday, 4 May 2023 22:28:44 PDT Thiago Macieira wrote:
> > But for those that use a very name, the API becomes cumbersome:
> >   Qt::Alignment al = Qt::AlignmentFlag::Left;
> > 
> > Can we do better? With C++20 using enum (GCC 11, Clang 13, so not in my
> > proposal) we could easily.
> 
> Actually, we can leave that as an optional feature for GCC 10 and Clang 10,
> if we choose those as our minima. We wouldn't be able to use the used
> enumerations in our code until the feature became mandatory, but users
> whose compilers do support the feature could use it.
> 
> https://codereview.qt-project.org/c/qt/qtbase/+/476084

Scratch that. This doesn't work and I don't know why:
https://gcc.godbolt.org/z/6jf7Ebecq

Looks like the using enum feature is not very useful for us. Back to the 
drawing board for scoped flags.

-- 
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/20230504/fa97edc3/attachment-0001.bin>


More information about the Development mailing list