pragma(inline, true) not very useful in its current state?

Manu via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 25 21:27:25 PDT 2015


On 25 September 2015 at 01:47, David Nadlinger via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> Hi all,
>
> [...]
> our resident Mr. Why-Can't-D-Be-More-Like-C++, Manu Evans

Bah, I'm not sure what this means. If you mean I advocate for things
that are perfect how they are in C/C++, precedented by decades of use
and millions of developers, remaining as people expect them to be...
then yes.
C++ didn't get *everything* wrong, otherwise D wouldn't be so much
like C++ to begin with. __forceinline in C++ is exactly what people
want here. The behaviour is useful, and well understood; compiler will
always inline if possible, and warn if it can't. There's nothing wrong
with C++ in this case, and I wish D would just be the same.

I'm happy for DMD to not inline anything in debug if it's technically
impossible due to compiler architecture, but it's not useful as an
error, that just forces you to remove it from your code if you want it
to compile. We don't have any tools in D at all to control whether
attributes like inline should or shouldn't be present between
different build configurations. We _really_ need attribute aliasing in
some form, especially since LDC/GDC have compiler-specific attributes
that DMD doesn't recognise.


More information about the Digitalmars-d mailing list