System programming in D (Was: The God Language)

Artur Skawina art.08.09 at gmail.com
Thu Jan 5 02:22:06 PST 2012


On 01/05/12 02:34, Iain Buclaw wrote:
> Code that gdc emits is incompatible with the standard D compiler, if
> that's what you want to call it, and any vendor extensions won't
> contribute to that being more of the case.
> 
> Regardless, there is little reason to want to use a forced inline with
> gdc.  Just like in c++ when you define all methods in the class
> definition, gdc considers all methods as candidates for inlining.
> Similarly, when -inline is passed, the same is also done for normal
> functions that are considered inlinable by the frontend.  These
> functions marked as inline are treated in the same way as a function
> declared 'inline' in C or C++, and will be treated as such by the
> backend.

"C" inline is, for historical reasons, ill-defined; i think what people are talking about in the context of D is the equivalent of gcc attribute(always_inline). Ie it's for the cases where not inlining is not an option. Having an explicit C-style "inline" hint is pointless - the compiler should be able to guess this right most of the time. It's for the cases where the programmer already knows the answer and is not willing to let the tool make a mistake.

artur


More information about the Digitalmars-d mailing list