Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Giving a program priority briefly



Josh Glover writes:

 > Steve, I think you know a little more about C++ compilers than I do;

Very little, I'd guess.  I did type in Hendrix's Small C by hand, and
I've got Ellis & Stroustrup, but I'm not at all up on C++ implementation.

 > any idea why g++ is ignoring the inline keyword to the detriment of
 > this program's performance?

One obvious factor would be if the base class is implemented in a
different .C from the derived class.  Compilers are much smarter than
linkers.  Also if it gets moved out of the declaration:

class eyes {
  int i;

 public:
  int gimme_an_i () { return i; }
};

is more likely to get inlined than

class eyes {
  int i;

 public:
  int gimme_an_i ();
};

int eyes::gimme_an_i () { return i; }

(However that last case probably gets a inline declaration in Darren's
code, and then it should be equivalent.)

Other than that I can't think of anything offhand.  My bet is that
somehow it's a "linkers are dumb" issue.



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links