This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -fobey-inline (was Re: gcc and inlining)
> Date: Sat, 15 Mar 2003 20:52:06 +0000 (GMT)
> From: Bernd Schmidt <bernds at redhat dot com>
> On Sat, 15 Mar 2003, Robert Dewar wrote:
>
> > > And why not? If I add the "inline" keyword, I do it for a good reason (I
> > > want the function inlined).
> >
> > even if it makes your program run slower? I think most programmers would
> > answer no .. they write inline to speed up their program, not slow it down
> > and make it bigger and slower :-)
>
> Well, you'd assume the person who adds "inline" has done measurements or
> looked at the generated assembly.
Often a mistaken assumption... and even if this was done, some time
in the past, there's no guarantee that it'll still be valid with the
current sources and current compiler.
> Humans are intelligent, something that is
> in general not true for computer programs. A source-level decision with the
> "inline" keyword can easily be controlled by the user - unless the compiler
> decides that it obviously knows more than the programmer. In that case,
> you either end up completely lacking the necessary control, or growing warts
> like "-fobey-inline" or the "always_inline" attribute.
The compiler can make decisions at a finer granulatity than "never
inline" or "always inline". It can take the location of the call into
account, for instance. Thus, it's possible to make the compiler good
enough that it *should* override the inline keyword in some cases.
--
- Geoffrey Keating <geoffk at geoffk dot org>