DIP56 - inlining

Johannes Pfau via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 4 03:08:13 PST 2015


Am Tue, 03 Feb 2015 14:29:59 -0800
schrieb Walter Bright <newshound2 at digitalmars.com>:

> http://wiki.dlang.org/DIP56
> 
> There's been enough discussion, time to make a decision and move on.
> 
> I changed the description to:
> 
> "If a pragma specifies always inline, and the compiler cannot inline
> it, a warning will be generated. Implementations will likely vary in
> their ability to inline."

One thing this DIP should clearly state is whether a pragma(inline,
true) functions must still have a valid address.

The answer is probably yes as this is how C compilers handle inline.
This however makes pragma(inline, true) functions less useful as
replacements for C macros: The compiler will still have to
generate a complete function which takes up space in the object
file.


The reasoning why it can't be an attribute is kinda flawed. People
want this to be an compiler recognized UDA like in GDC (1), not a
normal attribute. UDAs never affect the function signature. 

(1)
https://github.com/D-Programming-GDC/GDC/blob/master/libphobos/libdruntime/gcc/attribute.d



More information about the Digitalmars-d mailing list