Object file questions

Johannes Pfau via D.gnu d.gnu at puremagic.com
Sun Aug 17 01:31:47 PDT 2014


Am Sat, 16 Aug 2014 13:15:57 +0200
schrieb "Artur Skawina via D.gnu" <d.gnu at puremagic.com>:

> On 08/16/14 12:41, Mike via D.gnu wrote:
> > On Saturday, 16 August 2014 at 09:59:03 UTC, Artur Skawina via
> > D.gnu wrote:
> >>
> >> Taking the address of an always_inline function is allowed.
> >>
> > 
> > It may be allowed, but it probably shouldn't be.  Always-inlining a
> > function and taking the address of that function is contradictory.
> 
> Address-of should work -- disallowing it wouldn't help much, but would
> create problems for code that needs to call the function both directly
> and indirectly. This is actually a larger problem for D than for C
> (where it's allowed) because of generic code, templates and
> delegates. The alternative would be requiring trivial not- at inline
> wrappers and compile failures if one is accidentally forgotten.
> 
> A `@nocode` attribute would be a good idea, yes, but there's no need
> to make it implicit for `@inline`.

We can make this explicit. I don't care enough to argue about that.

> > But this situation demonstrates why having an intelligent linker is
> > a better solution than decorating with attributes.  The linker
> > should know if you took an address of an always-inlined function or
> > not and decide whether or not to remove it from the binary.
> 
> It already does. Apparently there are some kind of problems with
> certain setups, but, instead of addressing those problems, more and
> more /language/ hacks are proposed...
> 
> artur

So as you know all these problems and you know exactly how to fix them,
where's your contribution?


More information about the D.gnu mailing list