inlining with D

BCS BCS at pathlink.com
Thu Jan 18 10:30:00 PST 2007


orgoton wrote:
> With C++ i used the "inline" keyword. How to I instrument the D compiler to
> inline a function? 

use the -inline command line flag and DMD will start inlineing functions

 > If it does this automatically, what are the criteria?

A quick and dirty way to see what functions /may/ be inlined is to run 
DMD with the -H flag. This will generate a "header" file (<filename>.di) 
  that has prototypes for some functions and source for others. IIRC the 
cases with source are candidates for inlineing.

I seem to recall it amounts to short functions without ASM blocks or 
loops. But I'm sure that's not all and I may be wrong on that.



More information about the Digitalmars-d mailing list