c++11 enum syntax ok in DMD headers ?

Iain Buclaw ibuclaw at gdcproject.org
Fri Nov 22 08:29:07 UTC 2019


-------- Original Message --------
On Nov 22, 2019, 8:55 AM, S.G via D.gnu < d.gnu at puremagic.com> wrote:
Hello, I've seen that many D enum are still typed as int because
of the c++ headers but c++11 allow things like
enum Stuff: unsigned char { ... }
Is is ok to use this in the headers ?

The baseline bootstrapping compiler is C++98.

You don't have to type D enums as int, but the base type must be used explicitly if you want to use them as parameters or fields, which defeats some purposes of having the enum in the first place.

Work on autogenerating C++ headers should render this mostly redundant (people want freedom to pick their std version), apart from the not being able to use these enums as parameters due to ABI/mangling incompatibilities.

--
Iain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d.gnu/attachments/20191122/33ff8db5/attachment.htm>


More information about the D.gnu mailing list