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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:04:12+00:00 2026-06-17T15:04:12+00:00

The inline function is replaced by its code in the phase when the gcc

  • 0

The inline function is replaced by its code in the phase when the gcc generate the asm code.

What will be the behaviour when using inline for recursive function

inline int fact (int n)
{
    if (n<=1)
        return 1;
    else
        return (n * fact(n-1));
}

I generate the asm code with gcc -S when the recursive function is with inline prefix and when the recursive function is without the inline prefix and I found that the asm code for both cases is the same.

Have You any explanation for that ?

  • 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-17T15:04:14+00:00Added an answer on June 17, 2026 at 3:04 pm

    Note that inline is just an suggestion to the compiler which compiler may or may not accept. It is not binding on the compiler to adhere to your suggestion. An intelligent compiler will inline a function if it can even without the suggestion. Usually, for recursive functions compilers will do till certain depths.

    Why the compiler does not inline your function?

    With recursive functions compilers will usually look for the opportunity to perform tail call optimization. Your function is not tail call recursive.

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

Sidebar

Related Questions

I'm using an inline function to submit a form but it's not calling the
I have an inline member function defined under class MyClass int MyClass::myInlineFunction(); This function
I am trying to pass one variable to a jQuery function inline (i.e.: using
Assuming the following sample inline comment: /* function newMethodName (int bar, String s) {
I know that inline function are either replaced where it is called or behave
I am having a slight performance issue with inline function. Consider the following code:-
Tag System I'm Using (Link) Simply put the inline tag is never replaced by
Using the JS replace function with regex, and will have dozens of replace statements.
I'm writing a function to parse words inline in a contenteditable div and replace
Non inline function defined in header file with guards #if !defined(HEADER_RANDOM_H) #define HEADER_RANDOM_H void

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.