inlining...

Jacob Carlborg doob at me.com
Thu Mar 20 14:23:32 PDT 2014


On 2014-03-19 09:35, Manu wrote:

> I don't already have it, otherwise I'd be making use of it. D has no
> control over the inliner. GDC/LDC offer attributes, but then it's really
> annoying that D has no mechanism to make use of compiler-specific
> attributes in a portable way (ie, attribute aliasing), so I can't make
> use of those without significantly interfering with my code.

Can't you create a tuple with different attributes depending on which 
compiler is currently compiling? Something like this:

version (LDC)
     alias attributes = TypeTuple!(@attribute("forceinline");

else version (GDC)
     alias attributes = TypeTuple!(@attribute("forceinline"));

else version (DigitalMars)
     alias attributes = TypeTuple!();

else
     static assert(false);

@(attributes) void foo () { } // This assume that "attributes" will be 
expanded

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list