This is the mail archive of the gcc@gcc.gnu.org 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: #pragma interface and #pragma implementation


On Tue, Jun 01, 2004 at 03:42:42PM -0400, Steven T. Hatton wrote:

> I've been experimenting with the #pragma directives ...

I would advise against the use of #pragma interface and #pragma
implementation.  They are perhaps not quite obsolete, but they are
little-used today.

The original purpose of these directives was to permit the compiler to
generate only one global copy of certain types of objects, like virtual
function tables and non-inline copies of inline functions.  However, this
hack is far less necessary now, for two reasons:

1) For years now, g++ has implemented the "cfront hack": the virtual
function table is emitted only in the object file that implements the
first non-inline virtual function of the class.

2) On many platforms (including GNU/Linux and the BSDs) the linker is
capable of removing all but one copy of functions that are emitted at
multiple points.


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