[GSoC] Header Generation for C/C++

Manu turkeyman at gmail.com
Tue Jul 30 17:59:27 UTC 2019


On Tue, Jul 30, 2019 at 7:45 AM Eduard Staniloiu via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Monday, 29 July 2019 at 01:19:36 UTC, Manu wrote:
> > On Sun, Jul 28, 2019 at 5:20 PM Gregor Mückl via Digitalmars-d
> > <digitalmars-d at puremagic.com> wrote:
> >>
> >> On Monday, 22 July 2019 at 18:12:01 UTC, Manu wrote:
> >> > [...]
> >>
> >> That's a pretty neat hack!
> >>
> >> I'm just worried about two things:
> >> - it makes the generated code harder to read (not that big of a
> >> deal)
> >
> > Barely... and a generated header is not really for human
> > consumption either way.
> >
> >> - if you happen to include headers with conflicting D_ENUM*
> >> defines (e.g. a potential 3rd party D wrapper), you might get
> >> some nasty surprises :/
> >
> > C/C++ programmers now how to do macros and what to expect.
>
> So should we go ahead with generating code based on the
> `-extern-std` value or by using defines?
>
> After sleeping a bit on this, I prefer `-extern-std`.

It's possible that the correct answer is both.
The define technique I described empowers DMD to use its bizarre
naming strategy without special hacks in the header gen code.
I think perhaps the defines should be used, but the default code (when
the macros aren't specified by the user) could be driven by
-extern-std as you have it now.



More information about the Digitalmars-d mailing list