TITLE: Inlining, constructors, and CFront PROBLEM: Gtu@walter.bellcore.com (Darryl Rouse), Bellcore [ This joins a discussion of inefficiencies in C++. -adc ] HOWEVER ... many of your inline functions are quietly implemented out-of-line by the compiler (use the -w option with cfront.) RESPONSE: mat@mole-end.matawan.nj.us (Mark Terribile), 4 Dec 93 There's one particularly horrendous case around constructors. A member object can never need to be dynamically allocated, yet it's constructor will check its `this' pointer. For out-of-line constructors, that's OK, but when the constructor is moved inline, cfront should know to omit the ``if _this_ == 0 || ! ( _this_ = __nw( sizeof this ) ) ...'' code. Because it doesn't, a constructor whose members each have constructors initializing a few built-in types, a constructor that could be completely inlined with less overhead than the function call to the first constructor, becomes too complicated to inline. Out-of-line copies must be generated. This constructor happens to be for a template that is used in many places (a pointer that knows to deallocate what it holds when it is destroyed). Now an out-of-line copy of the constructor must be created for each specialization of the template. This is the only function that forces these copies to be made and compiled, so 20 or 30 more template instance files must be created and compiled each time. And of course, there is the lost space in the exectution image.