Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6894985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:51:04+00:00 2026-05-27T06:51:04+00:00

Edit : I’ve restored the original title but really what I should have asked

  • 0

Edit: I’ve restored the original title but really what I should have asked was this: ‘How do C++ linkers handle class methods which have been defined in multiple object files’

Say I have a C++ class defined in a header along these lines:

class Klass
{
    int Obnoxiously_Large_Method()
    {
        //many thousands of lines of code here
    }
}

If I compile some C++ code which uses ‘Obnoxiously_Large_Method’ in several locations, will the resulting object file always inline the code for ‘Obnoxiously_Large_Method’ or will it optimise for size (for example, when using g++ -Os) and create a single instance of ‘Obnoxiously_Large_Method’ and use it like a normal function?, if so, how do linkers resolve the collisions between other object files which have instantiated the same function?. Is there some arcane C++ namespace Juju which keeps the separate object instances of method from colliding with each other?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:51:04+00:00Added an answer on May 27, 2026 at 6:51 am

    7.1.2 Function specifiers

    A function declaration (8.3.5, 9.3, 11.4) with an inline specifier
    declares an inline function. The inline specifier indicates to the
    implementation that inline substitution of the function body at the
    point of call is to be preferred to the usual function call mechanism.
    An implementation is not required to perform this inline substitution
    at the point of call; however, even if this inline substitution is
    omitted, the other rules for inline functions defined by 7.1.2 shall
    still be respected.

    So, the compiler is not required to actually ‘inline’ any function.

    However, the standard also says,

    An inline function with external linkage shall have the same address in all translation units.

    Member functions normally have external linkage (one exception is when the member function belongs to a ‘local’ class), so inline functions must have a unique address for cases where the address of the function is taken. In this case, the compiler will arrange for the linker to throw away all but one instance of a non-inlined copy of the function and fix-up all address references to the function to be to the one that’s kept.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: This is solved now but I don't have enough rep to answer it
Edit: This was accidentally posted twice. Original: VB.NET Importing Classes I've seen some code
Edit: I have solved this by myself. See my answer below I have set
Edit: The below question was answered by this . I have a new updated
EDIT Leaving this for posterity, but nearly a year later, to get down voted,
EDIT: I have reworded the title question slightly, and adjusted the text to respond
EDIT: I asked around a bit, and apparently my mistake was this: we usually
Edit: This is conflicting when I try @NiftyDude's addition. Most pages: $(blockquote).appendTo(.entry); <div class=entry>
EDIT: This is just a tiny snippet of the code if you have any
Edit: This question was written in 2008, which was like 3 internet ages ago.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.