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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:44:38+00:00 2026-05-25T12:44:38+00:00

When a function which take a pointer in argument is inlined, does the compiler

  • 0

When a function which take a pointer in argument is inlined, does the compiler remove the indirection during the optimization process ? Of course when it makes sense..

Here is an obvious example:

inline void say_hello (person* p) {
    std::cout << "hello " << p->name << std::endl;
}

int main () {
    person goldorak;
    goldorak.name = "Goldorak";

    say_hello(&goldorak);
    return 0;
}

This case is trivial but if the compiler does the optimization is there some cases in which it doesn’t ?

Bonus: where can I get a list of some “basic” optimizations made by my compiler ?

Ps: I’m just curious

  • 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-25T12:44:38+00:00Added an answer on May 25, 2026 at 12:44 pm

    I’m assuming GCC,
    and so the link you are looking for is http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

    And to quote: (this may not be what you were getting at)

    -findirect-inlining
    Inline also indirect calls that are discovered to be known at
    compile time thanks to previous inlining. This option has any effect
    only when inlining itself is turned on by the -finline-functions or
    -finline-small-functions options.

    Enabled at level -O2.
    

    The equivilent documentation for Visual Studio compilers (including C++)
    http://msdn.microsoft.com/en-us/library/k1ack8f1.aspx
    (you can follow the links for more info)

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

Sidebar

Related Questions

Which algorithm does the JavaScript Array#sort() function use? I understand that it can take
I've a function which take an uint8_t * argument : uint8_t* ihex_decode(uint8_t *in, size_t
I have one template function which will take a pointer type and i have
I need a simple function which will take a FileInfo and a destination_directory_name as
Suppose I have a function which can either take an iterable/iterator or a non-iterable
Hi I was wondering if there is any jquery function around which can take
I have two Python functions, both of which take variable arguments in their function
Can u give me a simple function in vb.net which can take number of
Is there a standard C function similar to strtol which will take a char*
If you take a look at the clock_gettime() function, which is available in all

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.