On 15 Mar 2001, Lars Gullik Bjønnes wrote:

[How to avoid inlining to improve debugging]
> Well I consider compiling without -O an even bigger problem. Then a lot
> of small problems will not be noticed until you compile with
> optimization turned on.

Are you sure that there is not a flag to gcc such that you can compile
with -O, but without inlining?

I don't think it's a good trade-off to clutter all inlinings with
several lines of conditional preprocessor voodoo, just to avoid
a largely hypothetical problem!  Notice that most methods that
you inline are fairly trivial, and it's, in my experience, extremely
rare that you want to single-step through those.

I think this problem should be solved via a compiler switch - not
by cluttering the code.  If the compiler can't do this, fix the compiler
rather than cluttering the code.

Also, I don't think it's not a good trade-off to allow easy moving of
inline methods back and forth between the cpp/cxx/c++ files and the header
files by using the inline keyword.
The code is often easier to understand when the definition is close to the
declaration for these bits of code that are really simple.

It's not important that changing whether a method is inline or not should
be an easy operation. You only do this operation when you optimize the
code, and in this case, you should only do it after profiling. Therefore,
you can afford the extra trouble it is to inline it with a few more
lexical changes.

Greets,

Asger

Reply via email to