inlining or not inlining...

Jonathan M Davis jmdavisProg at gmx.com
Thu Feb 10 22:45:19 PST 2011


On Thursday 10 February 2011 22:35:34 Walter Bright wrote:
> Stewart Gordon wrote:
> > On 09/02/2011 12:14, spir wrote:
> >> Hello,
> >> 
> >> Walter states that inline annotations are useless, since programmers
> >> cannot generally know
> >> which function /should/ be inlined --depending on a variety of
> >> factors, inlining may in
> >> fact be counter-productive.
> > 
> > <snip>
> > 
> > I hate not being able to force functions to be inline.  A consequence is
> > that you can't fully interface certain APIs without an extra .lib over
> > what would be needed in C(++).
> 
> You cannot force inlining in C(++) either. The inline keyword is only a
> suggestion.

True. However, IIRC -O3 in gcc forces inlining, so in some cases you _can_ force 
it (though that's obviously compiler-specific), but forcing inlining with -O3 
does it for _everything_, so it's not exactly precision instrument.

Regardless, I would _hope_ that the compiler would be smart enough to make 
intelligent choices about inlining. That's probably one of those areas that can 
always be improved however.

- Jonathan M Davis


More information about the Digitalmars-d mailing list