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 8407109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:17:11+00:00 2026-06-09T23:17:11+00:00

I read this line in Stroustrup’s book: An i n l i n e

  • 0

I read this line in Stroustrup’s book:
“An i n l i n e function (§7.1.1, §10.2.9) must be defined – by identical definitions (§9.2.3) – in every translation unit in which it is used.”

What is the rationale behind “inline function need to be DEFINED in all tranlation units”?
Am I understanding it incorrectly? I know that with other functions declarations in all the translation units except one(that contains definition) would be fine.

  • 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-06-09T23:17:12+00:00Added an answer on June 9, 2026 at 11:17 pm

    Historically, C++ language compilers were built on principles of independent translation. Each translation unit is compiled completely independently (and only the linker sees the entire program).

    Under these circumstances, in order to perform inlining the compiler has to be able to see the source code of the function in each translation unit where it is called. For that, it has to be defined (i.e. declared with a body) in each translation unit.

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

Sidebar

Related Questions

I read this typedef line in a C++ book, but I couldn't resolve its
The program that I am writing needs to do this: read every line of
I have part of my script that goes like this: while read line do
count_record=file.readline() count_prev=count_record[:-1] , i used this to read the previous line and it worked
I read this code in a library which is used to display a bitmap
I happened to read this line of code: public MyArray this [int index]{ get{
I have a file bigger than 10G. To read this file line by line,
Tricky. My Rails models include lines like: scope :unread, where(arel_table[:read].eq(false)) This line can't run,
I just read this post about why new-line warnings exist, but to be honest
In Rails 3.0.X, this line used to work: email_banner = File.read(Rails.root.join('public/images/email_banner.png')) Since Rails 3.1

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.