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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:17:02+00:00 2026-05-10T19:17:02+00:00

What is the advantages/disadvantages of using inline functions in C++? I see that it

  • 0

What is the advantages/disadvantages of using inline functions in C++? I see that it only increases performance for the code that the compiler outputs, but with today’s optimized compilers, fast CPUs, huge memory etc. (not like in the 1980< where memory was scarce and everything had to fit in 100KB of memory) what advantages do they really have today?

  • 1 1 Answer
  • 3 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. 2026-05-10T19:17:03+00:00Added an answer on May 10, 2026 at 7:17 pm

    Inline functions are faster because you don’t need to push and pop things on/off the stack like parameters and the return address; however, it does make your binary slightly larger.

    Does it make a significant difference? Not noticeably enough on modern hardware for most. But it can make a difference, which is enough for some people.

    Marking something inline does not give you a guarantee that it will be inline. It’s just a suggestion to the compiler. Sometimes it’s not possible such as when you have a virtual function, or when there is recursion involved. And sometimes the compiler just chooses not to use it.

    I could see a situation like this making a detectable difference:

    inline int aplusb_pow2(int a, int b) {   return (a + b)*(a + b) ; }  for(int a = 0; a < 900000; ++a)     for(int b = 0; b < 900000; ++b)         aplusb_pow2(a, b); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What are the advantages/disadvantages of using include/require's to achieve a singular file that contains
What are the advantages and disadvantages of using Interlocked winapi functions instead of any
What advantages and disadvantages using nginx+Apache+mod_wsgi vs nginx+uWSGI(vurtualenv) in production Advantages of first variant
I'm doing some reading up on the advantages/disadvantages of using timestamps for concurrency control
What are the advantages and disadvantages of using one instead of the other in
Are there any advantages or disadvantages to using multiple assignment in a statement? In
In plain English, what are the disadvantages and advantages of using SET TRANSACTION ISOLATION
What are the advantages/disadvantages in placing a lengthy network access code in a thread
what is the advantages/disadvantages of using RIA against WCF without RIA?
Just out of interest is there any major advantages/disadvantages of using either? Straight from

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.