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

  • Home
  • SEARCH
  • 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 994721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:36:56+00:00 2026-05-16T06:36:56+00:00

What are the requirement for a function so it could be executed inline in

  • 0

What are the requirement for a function so it could be executed inline in C++?
Is there a case that a function can’t be inlined, or can any function be inlined and it is the responsibility of the programmer to decide how to define the function, based on run time and compilation-time considerations?

  • 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-16T06:36:56+00:00Added an answer on May 16, 2026 at 6:36 am

    what are the requirement for a
    function so it could be executed
    inline in c++?

    It needs to be defined at every spot in which it’s called (typically this is done by putting it in a .h).

    is there a case that a function can’t
    be inline?

    Not in terms of the language standard, I believe, although of course each compiler can and will implement some restrictions of its own.

    or any function can be inline and it
    is the responsibility of the
    programmer to decide how to define the
    function, based on run time and
    compilation-time considerations?

    The inline keyword is just a hint from the programmer to the compiler that the programmer would really like this function to be inlined (presumably the programmer has spotted substantial call overhead with a small function being called in “hot” loops as shown by the profiler — or, the function is so tiny that it’s about as small as the calling code;-) — or, inlining the function allows “optimization across function boundaries” that a particular compiler can’t spot or can’t perform otherwise — and so forth).

    The compiler is free to ignore the hint just as it’s free to ignore the older register hint for a variable’s storage class (I believe nowadays most optimizing C++ compilers do ignore register but fewer ignore inline) — IOW, the compiler is free to inline all or some of the calls to a function whether that function is declared inline or not.

    (Of course it won’t “inline calls” when they’re done through an explicit pointer to the function that is stashed away at some points and used at others, or when the function’s address is passed as a parameter to some other function – but that might affect the inlining of specific calls, not necessarily other calls to the same function that are done differently).

    “Just in case” your compiler takes your inline hints very earnestly, it’s often worth measuring code size and speed with and without inline around (unless your compiler offers an option/flag for the purpose, just a #define inline will definitely “disable” the effect of inline and thereby allow such measurement). But if you’re going to deploy your code across multiple compilers, esp. for multiple architectures, be aware that the effects that are positive on one platform may end up being counterproductive on another, given the difference in compilers’ optimizaiton strategies and in CPU architectures.

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

Sidebar

Ask A Question

Stats

  • Questions 501k
  • Answers 501k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Regex.Split is more capable, but for an arrangement with basic… May 16, 2026 at 2:23 pm
  • Editorial Team
    Editorial Team added an answer $row['NO'] = '<a href="javascript:void(0)" onClick="openmywindow(\''.$row['bcd'].'\',\''.$row['gfh'].'\',\'OPEN\',\''.$_REQUEST['test1'].'\')">'.$row['abc'].'</a>'; Because the escaping is very… May 16, 2026 at 2:23 pm
  • Editorial Team
    Editorial Team added an answer If the text field has focus, I believe the menu… May 16, 2026 at 2:23 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

The Question: Is there a way that I can pass a JavaScript function into
Situation : C#, .NET 3.5, WinForms Objective : Form1 has a Button that can
I got a strange requirement: function TextLimit(elem, maxChars) { ... } Where elem is
I have a website that uses basic ASP.Net forms authentication. In the web.config file
Not sure if this is possible in Dojo or JS for a function to
Consider the below Case 1: SDN#(X,) Case 2: SDN#(X,12) Case 3: SDN#(34,12) Case 4:
i have this code: function DisableDropDownsMonth() { $(.filterDropdown).val(0); $(.filterDropdown).attr(disabled, disabled); } to disable a
I am using the Magento's functionality to insert & update queries. My requirement is
I have a requirement to have a only a single instance of a class
In an application I'm working on I've found a weak escape function to prevent

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.