[GSoC] Header Generation for C/C++

Iain Buclaw ibuclaw at gdcproject.org
Thu Jul 18 04:57:23 UTC 2019


On Wed, 17 Jul 2019 at 22:59, Manu via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Wed, Jul 17, 2019 at 11:40 AM Eduard Staniloiu via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
> >
> > On Wednesday, 17 July 2019 at 17:41:23 UTC, Manu wrote:
> > > On Wed, Jul 17, 2019 at 4:40 AM Eduard Staniloiu via
> > > Digitalmars-d <digitalmars-d at puremagic.com> wrote:
> > >>
> > >> enum TestEnum
> > >> {
> > >>      TESTENUMaa = 0,
> > >>      TESTENUMbb = 1
> > >> };
> > >
> > > What in earth is that?
> >
> > This is the convention that is used in the manually written
> > headers in order to avoid name clashing between fields of
> > different enums in the C headers
>
> Okay... but it's also the worst thing ever, and no real user would
> want this code to be emit from the compiler ;)
> Safe to say this is a strictly DMD-specific naming pattern, and I
> don't think that should be our benchmark for a public-facing feature.
>
> A better non-C++11 name might be `TestEnum_aa`?


I guess the most typical C/C++98 style would be:

enum xml_status {
  XML_STATUS_ERROR = 0,
  XML_STATUS_OK = 1,
  XML_STATUS_SUSPENDED = 2
};

Some may want the enum to be called xml_status_flags, or some may want
a different prefix for the enum members.

-- 
Iain


More information about the Digitalmars-d mailing list