This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: #pragma interface and #pragma implementation
- From: Joe Buck <Joe dot Buck at synopsys dot COM>
- To: "Steven T. Hatton" <hattons at globalsymmetry dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 1 Jun 2004 17:10:18 -0700
- Subject: Re: #pragma interface and #pragma implementation
- References: <200406011542.55151.hattons@globalsymmetry.com>
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.