www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - DMD's inline switch

reply Def <Def_member pathlink.com> writes:
I have a question about DMD's -inline switch. IMPORTANT: I *do* already know the
general idea of inline from C, so you don't need to explain the basics to me
(unless my questions reveal a misconception about inline that I'm not aware of).

What I'd like to know is:

- If I *don't* use -inline, will DMD refuse to inline any function?
- If I *do* use -inline, will DMD inline all functions?
- Is there a way to let DMD's optimizer decide which functions to inline?

Thanks,
Def
Oct 01 2005
parent reply "Unknown W. Brackets" <unknown simplemachines.org> writes:
 - If I *don't* use -inline, will DMD refuse to inline any function?

I believe so, but whether or not... I suggest not depending on it.
 - If I *do* use -inline, will DMD inline all functions?

No. It will only inline certain functions which seem worthwhile.
 - Is there a way to let DMD's optimizer decide which functions to inline?

That would be what the option does ;). Of course, I would suggest using -O too, for optimized builds. -[Unknown]
Oct 01 2005
parent Def <Def_member pathlink.com> writes:
In article <dhn0gi$1jnf$1 digitaldaemon.com>, Unknown W. Brackets says...
 - If I *don't* use -inline, will DMD refuse to inline any function?

I believe so, but whether or not... I suggest not depending on it.
 - If I *do* use -inline, will DMD inline all functions?

No. It will only inline certain functions which seem worthwhile.
 - Is there a way to let DMD's optimizer decide which functions to inline?

That would be what the option does ;). Of course, I would suggest using -O too, for optimized builds. -[Unknown]

Sounds reasonable. Unless someone tells me otherwise, I will stick to your advice. Thanks heaps, Def
Oct 01 2005