This is the mail archive of the gcc-patches@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: C++ PATCH: PR 15815


Geoff Keating wrote:

I can think of one case.  Suppose you're writing a shared library, and
you want to make as much shared as possible.  It would be nice to be
able to force a single out-of-line copy of the inline function, so
that it doesn't get put in every application that uses the library.

In that case, you probably didn't really want it to be inline. If you really did want it to be inline with the shared object, but not in other parts of your application, then you need to create two different copies of the function -- an inline one and a non-inline one, which calls the inline version. Or, you can make the inline body visible only within the shared library, using macros.


"#pragma interface" and "#pragma implementation" are just unportable ways of doing that kind of thing.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com


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