This is the mail archive of the 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

On 09/06/2004, at 11:06 AM, Mark Mitchell wrote:

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.

No, no. You want it to be inlined everywhere. However, there are cases where it can't be inline (someone takes an address, -O0, whatever). In those cases, you'd like them to use one copy in the shared library, not a copy in each application. This is actually worse when the routine *is* a good candidate for inlining, because that's when it's least likely that the routine will end up in the shared library anyway.

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