This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: std::pow implementation (Robert Dewar) writes:

| The reason for not taking this view of inlining is that unless you
| get in the mindset that inlining will be done routinely by the
| compiler (at your direction) then you will tend to shy away from the
| use of trivial abstraction functions because you will worry about efficiency.

In effect, I find that it is the view that the C++ compiler always knows
better than the programmer that creates that sort of situation.
Should I use this compiler?  No! It does not listen to the
programmer.  Fear.
Will the compiler inline this simple function? I'm not sure, it just
keeps on doing what he thinks is best for me.  Uncertainty.
Should I program in C++ and use this compiler? Maybe not, some C++
compilers are notorously known not to inline inline function.  Doubt.

| The quote about premature optimization here is wrong I think. What Knuth
| was talking about (go back and look at what he really said, not just the
| sound bite) was distorting the code prematurely and unnecessarily in the
| interests of optimization.

| In fact, the liberal use of inline tends to *prevent* premature optimization

That might be true for Ada, I'm doubteful it translates to C++ word-for-word.

-- Gaby

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]